amitt001 / delegator.py

Subprocesses for Humans 2.0.
MIT License
1.7k stars 92 forks source link

Issues with "non-blocking" commands #38

Closed jcmcken closed 5 years ago

jcmcken commented 6 years ago

Not really sure how to title this, since I think my issue is just that some of the methods shown in the documentation just don't work, or perhaps it's not clearly explained what is meant by a 'non-blocking' command and I'm not using this correctly:

>>> import delegator
>>> c = delegator.run('sleep infinity', block=False)
>>> c.terminate()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/delegator.py", line 176, in terminate
    self.subprocess.terminate()
AttributeError: 'PopenSpawn' object has no attribute 'terminate'
>>> c.send('SIGTERM', signal=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/delegator.py", line 173, in send
    self.subprocess.send_signal(s)
AttributeError: 'PopenSpawn' object has no attribute 'send_signal'

When block=False, self.subprocess becomes a pexpect.popen_spawn.PopenSpawn, which doesn't implement many methods from subprocess.Popen, including send_signal, terminate, and probably others.

ParthS007 commented 5 years ago

Closing due to inactivity :+1: