Remove the dead function win32_spawn from methods.py.
(cherry picked from commit d78a78bc81
)
This commit is contained in:
parent
86ecefa1a2
commit
6e6db2d9cb
1 changed files with 0 additions and 47 deletions
47
methods.py
47
methods.py
|
@ -181,53 +181,6 @@ void unregister_module_types() {
|
||||||
return module_list
|
return module_list
|
||||||
|
|
||||||
|
|
||||||
def win32_spawn(sh, escape, cmd, args, env):
|
|
||||||
import subprocess
|
|
||||||
newargs = ' '.join(args[1:])
|
|
||||||
cmdline = cmd + " " + newargs
|
|
||||||
startupinfo = subprocess.STARTUPINFO()
|
|
||||||
for e in env:
|
|
||||||
if type(env[e]) != type(""):
|
|
||||||
env[e] = str(env[e])
|
|
||||||
proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
|
|
||||||
stderr=subprocess.PIPE, startupinfo=startupinfo, shell=False, env=env)
|
|
||||||
_, err = proc.communicate()
|
|
||||||
rv = proc.wait()
|
|
||||||
if rv:
|
|
||||||
print("=====")
|
|
||||||
print(err)
|
|
||||||
print("=====")
|
|
||||||
return rv
|
|
||||||
|
|
||||||
"""
|
|
||||||
def win32_spawn(sh, escape, cmd, args, spawnenv):
|
|
||||||
import win32file
|
|
||||||
import win32event
|
|
||||||
import win32process
|
|
||||||
import win32security
|
|
||||||
for var in spawnenv:
|
|
||||||
spawnenv[var] = spawnenv[var].encode('ascii', 'replace')
|
|
||||||
|
|
||||||
sAttrs = win32security.SECURITY_ATTRIBUTES()
|
|
||||||
StartupInfo = win32process.STARTUPINFO()
|
|
||||||
newargs = ' '.join(map(escape, args[1:]))
|
|
||||||
cmdline = cmd + " " + newargs
|
|
||||||
|
|
||||||
# check for any special operating system commands
|
|
||||||
if cmd == 'del':
|
|
||||||
for arg in args[1:]:
|
|
||||||
win32file.DeleteFile(arg)
|
|
||||||
exit_code = 0
|
|
||||||
else:
|
|
||||||
# otherwise execute the command.
|
|
||||||
hProcess, hThread, dwPid, dwTid = win32process.CreateProcess(None, cmdline, None, None, 1, 0, spawnenv, None, StartupInfo)
|
|
||||||
win32event.WaitForSingleObject(hProcess, win32event.INFINITE)
|
|
||||||
exit_code = win32process.GetExitCodeProcess(hProcess)
|
|
||||||
win32file.CloseHandle(hProcess);
|
|
||||||
win32file.CloseHandle(hThread);
|
|
||||||
return exit_code
|
|
||||||
"""
|
|
||||||
|
|
||||||
def disable_module(self):
|
def disable_module(self):
|
||||||
self.disabled_modules.append(self.current_module)
|
self.disabled_modules.append(self.current_module)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue