Dec-08-2017, 09:50 AM
It's like reading the docs from subprocess...
This program does not work with tools like midnight commander or screen.
#!/usr/bin/env python3 from subprocess import Popen, PIPE import sys args = sys.argv[1:] print('Program:', args[0]) print('Arguments:', args[1:]) proc = Popen(args, shell=False, stdout=PIPE, stderr=PIPE) stdout, stderr = proc.communicate() exitcode = proc.wait() print('Exitcode:', exitcode) print('Stdout:', stdout.decode()) print('Stderr:', stderr.decode()) sys.exit(exitcode)This example prints always: program, arguments, exitcode, stdout, stderr
This program does not work with tools like midnight commander or screen.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!