mirror of https://github.com/n1nj4sec/pupy.git
safepopen: add support for optional stdin oneshot buffer
This commit is contained in:
parent
5e93c40751
commit
c61c6f74c7
|
@ -88,6 +88,7 @@ class SafePopen(object):
|
|||
def __init__(self, *popen_args, **popen_kwargs):
|
||||
self._popen_args = popen_args
|
||||
self._interactive = popen_kwargs.pop('interactive', False)
|
||||
self._stdin_data = popen_kwargs.pop('stdin_data', None)
|
||||
self._suid = popen_kwargs.pop('suid', None)
|
||||
|
||||
if not ON_POSIX:
|
||||
|
@ -139,6 +140,10 @@ class SafePopen(object):
|
|||
**kwargs
|
||||
)
|
||||
|
||||
if self._stdin_data:
|
||||
self._pipe.stdin.write(self._stdin_data)
|
||||
self._pipe.stdin.flush()
|
||||
|
||||
if not self._interactive:
|
||||
self._pipe.stdin.close()
|
||||
|
||||
|
|
Loading…
Reference in New Issue