Apache/2.4.7 (Ubuntu) Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) safemode : OFF MySQL: ON | Perl: ON | cURL: OFF | WGet: ON > / usr / lib / python2.7 / dist-packages / twisted / internet / test / | server ip : 172.67.156.115 your ip : 172.71.254.71 H O M E |
Filename | /usr/lib/python2.7/dist-packages/twisted/internet/test/process_helper.py |
Size | 1.06 kb |
Permission | rw-r--r-- |
Owner | root : root |
Create time | 27-Apr-2025 09:56 |
Last modified | 27-Jul-2008 04:37 |
Last accessed | 07-Jul-2025 07:04 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
# A program which exits after starting a child which inherits its
# stdin/stdout/stderr and keeps them open until stdin is closed.
import sys, os
def grandchild():
sys.stdout.write('grandchild started')
sys.stdout.flush()
sys.stdin.read()
def main():
if sys.argv[1] == 'child':
if sys.argv[2] == 'windows':
import win32api as api, win32process as proc
info = proc.STARTUPINFO()
info.hStdInput = api.GetStdHandle(api.STD_INPUT_HANDLE)
info.hStdOutput = api.GetStdHandle(api.STD_OUTPUT_HANDLE)
info.hStdError = api.GetStdHandle(api.STD_ERROR_HANDLE)
python = sys.executable
scriptDir = os.path.dirname(__file__)
scriptName = os.path.basename(__file__)
proc.CreateProcess(
None, " ".join((python, scriptName, "grandchild")), None,
None, 1, 0, os.environ, scriptDir, info)
else:
if os.fork() == 0:
grandchild()
else:
grandchild()
if __name__ == '__main__':
main()