Message155391
| Author |
dabrahams |
| Recipients |
dabrahams |
| Date |
2012年03月11日.16:02:47 |
| SpamBayes Score |
2.098044e-12 |
| Marked as misclassified |
No |
| Message-id |
<1331481768.76.0.379134642234.issue14252@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Try the following script on posix and Windows. On Posix:
launched
. . . exiting
killed
on Windows:
launched
. . . exiting
Traceback (most recent call last):
File "sp.py", line 16, in <module>
p.terminate()
File "c:\Python26\lib\subprocess.py", line 949, in terminate
_subprocess.TerminateProcess(self._handle, 1)
WindowsError: [Error 5] Access is denied
This inconsistency seems unnecessary and is an obstacle to writing portable code.
from subprocess import *
import sys, time
p = Popen([sys.executable, '-c', '''
import time, sys
for i in range(3):
time.sleep(.3)
print '.',
sys.stdout.flush()
print 'exiting'
'''], stdout = sys.stdout, stderr = sys.stderr)
print 'launched'
time.sleep(2)
p.terminate()
print 'killed' |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2012年03月11日 16:02:48 | dabrahams | set | recipients:
+ dabrahams |
| 2012年03月11日 16:02:48 | dabrahams | set | messageid: <1331481768.76.0.379134642234.issue14252@psf.upfronthosting.co.za> |
| 2012年03月11日 16:02:48 | dabrahams | link | issue14252 messages |
| 2012年03月11日 16:02:47 | dabrahams | create |
|