diff options
Diffstat (limited to 'bin/setsid.py')
-rwxr-xr-x | bin/setsid.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/bin/setsid.py b/bin/setsid.py new file mode 100755 index 00000000..32002ec7 --- /dev/null +++ b/bin/setsid.py @@ -0,0 +1,16 @@ +#!/usr/bin/python +"""backport of util-linux' setsid -w to Debian stable""" + +import os +import sys + +if __name__ == "__main__": + assert len(sys.argv) > 1 + pid = os.fork() + if pid == 0: + os.setsid() + os.execvp(sys.argv[1], sys.argv[1:]) + else: + cpid, status = os.wait() + assert cpid == pid + sys.exit(os.WEXITSTATUS(status)) |