mirror of
https://github.com/Gallopsled/pwntools.git
synced 2026-11-07 17:14:22 -10:00
close file descriptors in process.close() and avoid leaving zombie processes around
(cherry picked from commit fa2e11391e)
This commit is contained in:
1 parent
29eefaac2b
commit
442873e5be
1 file changed
+9
@@ -454,9 +454,18 @@ class process(tube):
|
||||
# First check if we are already dead
|
||||
self.poll()
|
||||
|
||||
#close file descriptors
|
||||
if self.proc.stdin is not None:
|
||||
self.proc.stdin.close()
|
||||
if self.proc.stderr is not None:
|
||||
self.proc.stderr.close()
|
||||
if self.proc.stdout is not None:
|
||||
self.proc.stdout.close()
|
||||
|
||||
if not self._stop_noticed:
|
||||
try:
|
||||
self.proc.kill()
|
||||
self.proc.wait() #avoid leaving zombies around
|
||||
self._stop_noticed = True
|
||||
self.info('Stopped program %r' % self.program)
|
||||
except OSError:
|
||||
|
||||
Reference in new issue
Block a user