File tree Expand file tree Collapse file tree 1 file changed +4
-23
lines changed Expand file tree Collapse file tree 1 file changed +4
-23
lines changed Original file line number Diff line number Diff line change @@ -32,29 +32,12 @@ def kill(self):
32
32
33
33
def killpopen (popen ):
34
34
try :
35
- if hasattr (popen , "kill" ):
36
- popen .kill ()
37
- else :
38
- killpid (popen .pid )
39
- except OSError :
40
- sys .stderr .write ("ERROR killing: %s\n " % (sys .exc_info ()[1 ]))
35
+ popen .kill ()
36
+ except OSError as e :
37
+ sys .stderr .write ("ERROR killing: %s\n " % e )
41
38
sys .stderr .flush ()
42
39
43
40
44
- def killpid (pid ):
45
- if hasattr (os , "kill" ):
46
- os .kill (pid , 15 )
47
- elif sys .platform == "win32" or getattr (os , "_name" , None ) == "nt" :
48
- import ctypes
49
-
50
- PROCESS_TERMINATE = 1
51
- handle = ctypes .windll .kernel32 .OpenProcess (PROCESS_TERMINATE , False , pid )
52
- ctypes .windll .kernel32 .TerminateProcess (handle , - 1 )
53
- ctypes .windll .kernel32 .CloseHandle (handle )
54
- else :
55
- raise OSError (f"no method to kill { pid } " )
56
-
57
-
58
41
popen_bootstrapline = "import sys;exec(eval(sys.stdin.readline()))"
59
42
60
43
@@ -72,10 +55,8 @@ def shell_split_path(path):
72
55
def popen_args (spec ):
73
56
args = shell_split_path (spec .python ) if spec .python else [sys .executable ]
74
57
args .append ("-u" )
75
- if spec is not None and spec .dont_write_bytecode :
58
+ if spec .dont_write_bytecode :
76
59
args .append ("-B" )
77
- # Slight gymnastics in ordering these arguments because CPython (as of
78
- # 2.7.1) ignores -B if you provide `python -c "something" -B`
79
60
args .extend (["-c" , popen_bootstrapline ])
80
61
return args
81
62
You can’t perform that action at this time.
0 commit comments