New submission from Ben Kane: On page https://docs.python.org/3/library/subprocess.html#replacing-os-system
it looks like the code in the realistic example has a spurious '-' sign. The line: print("Child was terminated by signal", -retcode, file=sys.stderr) shouldn't have the minus sign negating the retcode: print("Child was terminated by signal", retcode, file=sys.stderr) Full code in the example: try: retcode = call("mycmd" + " myarg", shell=True) if retcode < 0: print("Child was terminated by signal", -retcode, file=sys.stderr) else: print("Child returned", retcode, file=sys.stderr) except OSError as e: print("Execution failed:", e, file=sys.stderr) should be: try: retcode = call("mycmd" + " myarg", shell=True) if retcode < 0: print("Child was terminated by signal", retcode, file=sys.stderr) else: print("Child returned", retcode, file=sys.stderr) except OSError as e: print("Execution failed:", e, file=sys.stderr) Thanks, and apologies if I erred somewhere in this report. ---------- assignee: docs@python components: Documentation messages: 266614 nosy: Ben Kane, docs@python priority: normal severity: normal status: open title: '-' sign typo in example type: behavior versions: Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27155> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com