clarify code

This commit is contained in:
cosine0 2020-12-03 14:14:07 +09:00
parent cbece2ffe5
commit d66204ce9c
2 changed files with 6 additions and 7 deletions

View File

@ -27,7 +27,7 @@ def main():
args = parser.parse_args()
exe_path = args.exe
script_path = args.python_script
script_path = os.path.abspath(args.python_script)
pid = subprocess.Popen(exe_path).pid
injector_path = os.path.join(SCRIPT_DIR, 'mayhem', 'tools', 'python_injector.py')
@ -38,12 +38,11 @@ def main():
else:
envs['PATH'] = INTERPRETER_DIR
f = tempfile.NamedTemporaryFile(suffix='.py', delete=False)
formatted_script = injected_script.format(working_dir=os.path.abspath(os.curdir),
import_path=script_path).encode('utf8')
with tempfile.NamedTemporaryFile(suffix='.py', delete=False) as f:
formatted_script = injected_script.format(working_dir=os.path.abspath(os.curdir),
import_path=script_path).encode('utf8')
f.write(formatted_script)
f.close()
f.write(formatted_script)
subprocess.Popen([sys.executable, injector_path, f.name, str(pid)],
env=envs).wait()

@ -1 +1 @@
Subproject commit a8d7efe074b8f09fafadfa86a36f0a0fe4632b6c
Subproject commit c5fca48dd9a4022e0a6fd9fca430d73811955ff5