mirror of
https://github.com/clearml/wexpect-venv
synced 2025-02-07 13:30:56 +00:00
[FIX] process termination and exitstatus
This commit is contained in:
parent
51426bc41d
commit
80f63d47ef
@ -52,6 +52,7 @@ class IsAliveTestCase(PexpectTestCase.PexpectTestCase):
|
|||||||
def test_expect_isalive_dead_after_normal_termination (self):
|
def test_expect_isalive_dead_after_normal_termination (self):
|
||||||
p = wexpect.spawn('ls', timeout=15)
|
p = wexpect.spawn('ls', timeout=15)
|
||||||
p.expect(wexpect.EOF)
|
p.expect(wexpect.EOF)
|
||||||
|
time.sleep(.5)
|
||||||
assert not p.isalive()
|
assert not p.isalive()
|
||||||
|
|
||||||
def test_expect_isalive_dead_after_SIGHUP(self):
|
def test_expect_isalive_dead_after_SIGHUP(self):
|
||||||
@ -77,7 +78,7 @@ class IsAliveTestCase(PexpectTestCase.PexpectTestCase):
|
|||||||
def test_expect_isalive_dead_after_SIGKILL(self):
|
def test_expect_isalive_dead_after_SIGKILL(self):
|
||||||
p = wexpect.spawn('cat', timeout=5)
|
p = wexpect.spawn('cat', timeout=5)
|
||||||
assert p.isalive()
|
assert p.isalive()
|
||||||
p.kill(9)
|
p.kill()
|
||||||
p.expect(wexpect.EOF)
|
p.expect(wexpect.EOF)
|
||||||
assert not p.isalive()
|
assert not p.isalive()
|
||||||
|
|
||||||
@ -99,6 +100,7 @@ class IsAliveTestCase(PexpectTestCase.PexpectTestCase):
|
|||||||
assert p.isalive()
|
assert p.isalive()
|
||||||
p.sendeof()
|
p.sendeof()
|
||||||
p.expect(wexpect.EOF)
|
p.expect(wexpect.EOF)
|
||||||
|
time.sleep(.5)
|
||||||
assert not p.isalive()
|
assert not p.isalive()
|
||||||
assert not p.isalive()
|
assert not p.isalive()
|
||||||
|
|
||||||
|
@ -441,7 +441,8 @@ class SpawnBase:
|
|||||||
if child:
|
if child:
|
||||||
self.child_process.wait()
|
self.child_process.wait()
|
||||||
if console:
|
if console:
|
||||||
self.console_process.wait()
|
self.exitstatus = self.console_process.wait()
|
||||||
|
return self.exitstatus
|
||||||
|
|
||||||
def read (self, size = -1): # File-like object.
|
def read (self, size = -1): # File-like object.
|
||||||
"""This reads at most "size" bytes from the file (less if the read hits
|
"""This reads at most "size" bytes from the file (less if the read hits
|
||||||
|
Loading…
Reference in New Issue
Block a user