OLD | NEW |
1 # subprocess - Subprocesses with accessible I/O streams | 1 # subprocess - Subprocesses with accessible I/O streams |
2 # | 2 # |
3 # For more information about this module, see PEP 324. | 3 # For more information about this module, see PEP 324. |
4 # | 4 # |
5 # This module should remain compatible with Python 2.2, see PEP 291. | 5 # This module should remain compatible with Python 2.2, see PEP 291. |
6 # | 6 # |
7 # Copyright (c) 2003-2005 by Peter Astrand <astrand@lysator.liu.se> | 7 # Copyright (c) 2003-2005 by Peter Astrand <astrand@lysator.liu.se> |
8 # | 8 # |
9 # Licensed to PSF under a Contributor Agreement. | 9 # Licensed to PSF under a Contributor Agreement. |
10 # See http://www.python.org/2.4/license for licensing details. | 10 # See http://www.python.org/2.4/license for licensing details. |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 STD_OUTPUT_HANDLE, STD_ERROR_HANDLE | 387 STD_OUTPUT_HANDLE, STD_ERROR_HANDLE |
388 from win32api import GetCurrentProcess, DuplicateHandle, \ | 388 from win32api import GetCurrentProcess, DuplicateHandle, \ |
389 GetModuleFileName, GetVersion | 389 GetModuleFileName, GetVersion |
390 from win32con import DUPLICATE_SAME_ACCESS, SW_HIDE | 390 from win32con import DUPLICATE_SAME_ACCESS, SW_HIDE |
391 from win32pipe import CreatePipe | 391 from win32pipe import CreatePipe |
392 from win32process import CreateProcess, STARTUPINFO, \ | 392 from win32process import CreateProcess, STARTUPINFO, \ |
393 GetExitCodeProcess, STARTF_USESTDHANDLES, \ | 393 GetExitCodeProcess, STARTF_USESTDHANDLES, \ |
394 STARTF_USESHOWWINDOW, CREATE_NEW_CONSOLE | 394 STARTF_USESHOWWINDOW, CREATE_NEW_CONSOLE |
395 from win32event import WaitForSingleObject, INFINITE, WAIT_OBJECT_0 | 395 from win32event import WaitForSingleObject, INFINITE, WAIT_OBJECT_0 |
396 else: | 396 else: |
397 from _subprocess import * | 397 # SCons: don't die on Python versions that don't have _subprocess. |
| 398 try: |
| 399 from _subprocess import * |
| 400 except ImportError: |
| 401 pass |
398 class STARTUPINFO: | 402 class STARTUPINFO: |
399 dwFlags = 0 | 403 dwFlags = 0 |
400 hStdInput = None | 404 hStdInput = None |
401 hStdOutput = None | 405 hStdOutput = None |
402 hStdError = None | 406 hStdError = None |
403 wShowWindow = 0 | 407 wShowWindow = 0 |
404 class pywintypes: | 408 class pywintypes: |
405 error = IOError | 409 error = IOError |
406 else: | 410 else: |
407 import select | 411 import select |
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1277 print "Executing calc..." | 1281 print "Executing calc..." |
1278 p = Popen("calc") | 1282 p = Popen("calc") |
1279 p.wait() | 1283 p.wait() |
1280 | 1284 |
1281 | 1285 |
1282 if __name__ == "__main__": | 1286 if __name__ == "__main__": |
1283 if mswindows: | 1287 if mswindows: |
1284 _demo_windows() | 1288 _demo_windows() |
1285 else: | 1289 else: |
1286 _demo_posix() | 1290 _demo_posix() |
OLD | NEW |