Skip to content
Snippets Groups Projects
Commit ce167380 authored by cody burkard's avatar cody burkard
Browse files

clean up logic for backgrounded processes

parent c11d5773
No related branches found
No related tags found
No related merge requests found
......@@ -239,16 +239,12 @@ def sendCmd( self, *args, **kwargs ):
# Replace empty commands with something harmless
cmd = 'echo -n'
self.lastCmd = cmd
if printPid and not isShellBuiltin( cmd ):
if len( cmd ) > 0 and cmd[ -1 ] == '&':
# print ^A{pid}\n so monitor() can set lastPid
cmd += ' printf "\\001%d\\012" $! '
else:
cmd = 'mnexec -p ' + cmd
# if a builtin command is backgrounded, it yields a PID
elif isShellBuiltin( cmd ):
if len( cmd ) > 0 and cmd[ -1 ] == '&':
cmd += ' printf "\\001%d\\012" $! '
# if a builtin command is backgrounded, it still yields a PID
if len( cmd ) > 0 and cmd[ -1 ] == '&':
# print ^A{pid}\n so monitor() can set lastPid
cmd += ' printf "\\001%d\\012" $! '
elif printPid and not isShellBuiltin( cmd ):
cmd = 'mnexec -p ' + cmd
self.write( cmd + '\n' )
self.lastPid = None
self.waiting = True
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment