Fix non-interactive memexec launch for linux

This commit is contained in:
Oleksii Shevchuk 2017-07-22 20:11:50 +03:00
parent 4940035bd2
commit 1b6ffdf7b4
2 changed files with 10 additions and 0 deletions

View File

@ -13,6 +13,7 @@ def mexec(module, path, argv, argv0=None, interactive=False, raw=False, codepage
data, argv0, args = argv,
no_stdin = not interactive,
no_stdor = not interactive,
redirect_stdio = interactive,
compressed = True,
terminate = interactive
)
@ -44,3 +45,9 @@ def mexec(module, path, argv, argv0=None, interactive=False, raw=False, codepage
else:
complete.set()
module.error('Launch failed. Press ENTER')
else:
if module.mp.run():
module.success('Process started: {}'.format(module.mp.pid))
else:
module.error('Launch failed')

View File

@ -194,6 +194,9 @@ class MExec(object):
self.pid = pid
self.stdin, self.stdout, self.stderr = stdior
if not self.redirect_stdio:
return True
if self.no_stdin:
self.stdin.close()
self.stdin = None