clean up logic for backgrounded processes
This commit is contained in:
+6
-10
@@ -239,16 +239,12 @@ class Node( object ):
|
|||||||
# Replace empty commands with something harmless
|
# Replace empty commands with something harmless
|
||||||
cmd = 'echo -n'
|
cmd = 'echo -n'
|
||||||
self.lastCmd = cmd
|
self.lastCmd = cmd
|
||||||
if printPid and not isShellBuiltin( cmd ):
|
# if a builtin command is backgrounded, it still yields a PID
|
||||||
if len( cmd ) > 0 and cmd[ -1 ] == '&':
|
if len( cmd ) > 0 and cmd[ -1 ] == '&':
|
||||||
# print ^A{pid}\n so monitor() can set lastPid
|
# print ^A{pid}\n so monitor() can set lastPid
|
||||||
cmd += ' printf "\\001%d\\012" $! '
|
cmd += ' printf "\\001%d\\012" $! '
|
||||||
else:
|
elif printPid and not isShellBuiltin( cmd ):
|
||||||
cmd = 'mnexec -p ' + cmd
|
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" $! '
|
|
||||||
self.write( cmd + '\n' )
|
self.write( cmd + '\n' )
|
||||||
self.lastPid = None
|
self.lastPid = None
|
||||||
self.waiting = True
|
self.waiting = True
|
||||||
|
|||||||
Reference in New Issue
Block a user