shell_command: remove "fire and forget" functionality
A consumer of shell command can achieve "fire and forget" by scheduling the future returned by "run()" to execute on the event loop. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
dc165636cb
commit
44f1147f71
|
@ -105,18 +105,14 @@ class ShellCommand:
|
|||
async def run(self, timeout=2., verbose=True):
|
||||
self.return_code = self.proc = None
|
||||
self.cancelled = False
|
||||
if timeout is None:
|
||||
if not timeout:
|
||||
# Never timeout
|
||||
timeout = 9999999999999999.
|
||||
if not timeout or self.output_cb is None:
|
||||
# Fire and forget commands cannot be verbose as we can't
|
||||
# clean up after the process terminates
|
||||
if self.std_out_cb is None and self.std_err_cb is None:
|
||||
# No callbacks set so output cannot be verbose
|
||||
verbose = False
|
||||
if not await self._create_subprocess():
|
||||
return False
|
||||
if not timeout:
|
||||
# fire and forget, return from execution
|
||||
return True
|
||||
try:
|
||||
if verbose:
|
||||
ret = self.proc.communicate_with_cb()
|
||||
|
|
Loading…
Reference in New Issue