Skip to content

Commit

Permalink
Merge pull request not-kennethreitz#36 from adammck/fix_connected_com…
Browse files Browse the repository at this point in the history
…mand_status_code

Fix ConnectedCommand.status_code
  • Loading branch information
Kenneth Reitz committed Jun 9, 2012
2 parents 84ec6c0 + 9bf5911 commit 21e5adb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 2 additions & 5 deletions envoy/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def __init__(self,
self.std_in = std_in
self.std_out = std_out
self.std_err = std_out
self._status_code = None

def __enter__(self):
return self
Expand All @@ -112,11 +113,7 @@ def status_code(self):
"""The status code of the process.
If the code is None, assume that it's still running.
"""
if self._status_code is not None:
return self._status_code

# investigate
return None
return self._status_code

@property
def pid(self):
Expand Down
6 changes: 6 additions & 0 deletions test_envoy.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,11 @@ def test_quoted_args(self):
self.assertEqual(r.std_out.rstrip(), sentinel)
self.assertEqual(r.status_code, 0)

class ConnectedCommandTests(unittest.TestCase):

def test_status_code(self):
c = envoy.connect("sleep 5")
self.assertEqual(c.status_code, None)

if __name__ == "__main__":
unittest.main()

0 comments on commit 21e5adb

Please sign in to comment.