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):
|
async def run(self, timeout=2., verbose=True):
|
||||||
self.return_code = self.proc = None
|
self.return_code = self.proc = None
|
||||||
self.cancelled = False
|
self.cancelled = False
|
||||||
if timeout is None:
|
if not timeout:
|
||||||
# Never timeout
|
# Never timeout
|
||||||
timeout = 9999999999999999.
|
timeout = 9999999999999999.
|
||||||
if not timeout or self.output_cb is None:
|
if self.std_out_cb is None and self.std_err_cb is None:
|
||||||
# Fire and forget commands cannot be verbose as we can't
|
# No callbacks set so output cannot be verbose
|
||||||
# clean up after the process terminates
|
|
||||||
verbose = False
|
verbose = False
|
||||||
if not await self._create_subprocess():
|
if not await self._create_subprocess():
|
||||||
return False
|
return False
|
||||||
if not timeout:
|
|
||||||
# fire and forget, return from execution
|
|
||||||
return True
|
|
||||||
try:
|
try:
|
||||||
if verbose:
|
if verbose:
|
||||||
ret = self.proc.communicate_with_cb()
|
ret = self.proc.communicate_with_cb()
|
||||||
|
|
Loading…
Reference in New Issue