Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pid doesn't print when executing commands #931

Open
tkoch96 opened this issue Mar 9, 2020 · 1 comment
Open

Pid doesn't print when executing commands #931

tkoch96 opened this issue Mar 9, 2020 · 1 comment

Comments

@tkoch96
Copy link

tkoch96 commented Mar 9, 2020

I'm referring to the function Mininet/node.py: cmd

When doing node.cmd(cmd, printPid=True), it doesn't print the PID. cmd is, for example, running another Python script. These are commands with the '&' appended, so that script continues to execute in the background.

Commenting out these lines:
if len( cmd ) > 0 and cmd[ -1 ] == '&': # print ^A{pid}\n so monitor() can set lastPid cmd += ' printf "\\001%d\\012" $! '

in node.py and changing the elif to if on the following line results in the desirable output for me.

@lantz
Copy link
Member

lantz commented Mar 9, 2020

Printing the pid is for the benefit of lastPid; if you want it yourself for something that is running in the background then you can just run 'echo $!'; I don't have time to look at it now, but I seem to recall that that check is in there for a reason like breaking lastPid and/or confusing sentinel/prompt detection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants