parsed.org

Tips by tag: signal

os.system and Broken Pipes by cygnus on Dec 31, 2005 04:08 PM

If you're using os.system to run a command (such as xterm running man) and you get "broken pipe" errors, you can restore standard pipe functionality with the signal module:

import signal
signal.signal(signal.SIGPIPE, signal.SIG_DFL)

# Call os.system after calling signal.signal.

Note: information taken from http://monkeyfingers.org/ (page now unavailable).

brokenlanguagesospipeprogrammingpythonsignalsystemunix
RSS