From 6e6db2d9cbb7cf1cfa57448c63211adc607080c9 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 18 Mar 2020 16:18:18 +0530 Subject: [PATCH] Remove the dead function win32_spawn from methods.py. (cherry picked from commit d78a78bc815397b75d49fec7abf714e1c7f99421) --- methods.py | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) diff --git a/methods.py b/methods.py index 6b97acf822b..122d6826925 100644 --- a/methods.py +++ b/methods.py @@ -181,53 +181,6 @@ void unregister_module_types() { 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): self.disabled_modules.append(self.current_module)