From 9c7e77caff348b5e1b5b59a180c0fa7104c170b6 Mon Sep 17 00:00:00 2001 From: yasuda Date: Thu, 25 Jan 2024 10:15:37 +0900 Subject: [PATCH 1/2] Return exit code 16 if no entry found --- bin/cppman | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/cppman b/bin/cppman index e427186..e8e20ef 100755 --- a/bin/cppman +++ b/bin/cppman @@ -162,6 +162,7 @@ def main(): pid = cm.man(args[0]) except RuntimeError as e: print(e) + sys.exit(16) else: os.waitpid(pid, 0) From 6a0446145d7259a21b885b3bf0917d18fd2b6cfe Mon Sep 17 00:00:00 2001 From: yasuda Date: Thu, 25 Jan 2024 10:16:16 +0900 Subject: [PATCH 2/2] Write error messages into std.err --- bin/cppman | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/cppman b/bin/cppman index e8e20ef..8919af6 100755 --- a/bin/cppman +++ b/bin/cppman @@ -161,7 +161,7 @@ def main(): try: pid = cm.man(args[0]) except RuntimeError as e: - print(e) + print(e, file=sys.stderr) sys.exit(16) else: os.waitpid(pid, 0) @@ -173,6 +173,6 @@ if __name__ == '__main__': sys.exit() except (Exception, KeyboardInterrupt) as e: if type(e) == KeyboardInterrupt: - print('\nAborted.') + print('\nAborted.', file=sys.stderr) else: - print('error:', e) + print('error:', e, file=sys.stderr)