Skip to content
Snippets Groups Projects
Commit d1b29d58 authored by Bob Lantz's avatar Bob Lantz
Browse files

Fix printing pid for background tasks.

parent ba8d4f9b
No related branches found
No related tags found
No related merge requests found
......@@ -206,15 +206,17 @@ def sendCmd( self, *args, **kwargs ):
if not re.search( r'\w', cmd ):
# Replace empty commands with something harmless
cmd = 'echo -n'
self.lastCmd = cmd
printPid = printPid and not isShellBuiltin( cmd )
if len( cmd ) > 0 and cmd[ -1 ] == '&':
separator = '&'
cmd = cmd[ :-1 ]
# print ^A{pid}\n{sentinel}
cmd += ' printf "\\001%d\n\\177" $! \n'
else:
separator = ';'
# print sentinel
cmd += '; printf "\\177"'
if printPid and not isShellBuiltin( cmd ):
cmd = 'mnexec -p ' + cmd
self.write( cmd + separator + ' printf "\\177" \n' )
self.lastCmd = 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