mirror of https://github.com/n1nj4sec/pupy.git
Try as much as possible to read process status
This commit is contained in:
parent
45ac2bf02e
commit
1e01b0ad0a
|
@ -1,6 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Nicolas VERDIER (contact@n1nj4.eu)
|
||||
# Pupy is under the BSD 3-Clause license. see the LICENSE file at the root of the project for the detailed licence terms
|
||||
|
||||
import sys
|
||||
import os
|
||||
import os.path
|
||||
|
@ -25,8 +26,19 @@ class PtyShell(object):
|
|||
self.real_stdout = sys.stdout
|
||||
|
||||
def close(self):
|
||||
if self.prog is not None and self.prog.returncode is None:
|
||||
self.prog.terminate()
|
||||
if self.prog is not None:
|
||||
self.prog.poll()
|
||||
|
||||
if self.prog.returncode is None:
|
||||
try:
|
||||
self.prog.terminate()
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
self.prog.poll()
|
||||
except:
|
||||
pass
|
||||
|
||||
def __del__(self):
|
||||
self.close()
|
||||
|
|
Loading…
Reference in New Issue