The output of the ps x | ... command is not checked to see if a PID was actually retrieved. This can happen with a command that is long enough that the $shellId doesn't appear because it's only using ps x instead of ps wwx.
You could also eliminate the use of grep by making it: ps wwx | awk '/$shellId/ && !/awk/ {print \$1; exit}'
The output of the
ps x | ...
command is not checked to see if a PID was actually retrieved. This can happen with a command that is long enough that the$shellId
doesn't appear because it's only usingps x
instead ofps wwx
.You could also eliminate the use of grep by making it:
ps wwx | awk '/$shellId/ && !/awk/ {print \$1; exit}'
https://github.com/deployphp/deployer/blob/51e8e82c0726b0386d2989c42df003899d35af8a/src/Component/Ssh/Client.php#L96-L99
Upvote & Fund