Status of an Exec node

Hi,
I am try to get the status of an exec-node using the status-node.
For some reason I can catch when the node is killed but not when it has a pid. When I start the exec node, the function attached to the status node immediately jumps to the last statement "unknown process status".
This is a simplified version of my flow. I have omitted the exec node because it would also need the python script attached to it.
However the status node is clearly outputting:

  • "pid:1234" when in execution and:
  • "killed" when stopped.
    do you see anything wrong that cause the pid:1234 not be intercepted
var test = msg.status.text;

if (test.includes('pid:')) { 
  msg.payload="Process running"
}
if (test.includes('kill')) { 
  msg.payload="Process stopped"
}
else {
    msg.payload="unknow process status"
}
return msg;
[{"id":"ee1921195e1f3b6c","type":"status","z":"c77ba1683e345234","name":"ExecStatus","scope":["c4ff59a7c876123f"],"x":1090,"y":500,"wires":[["d78095b461723415","902fd20e2c38a409"]]},{"id":"cac9c0b90cab337b","type":"debug","z":"c77ba1683e345234","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1470,"y":480,"wires":[]},{"id":"d78095b461723415","type":"function","z":"c77ba1683e345234","name":"","func":"\nvar test = msg.status.text;\n\nif (test.includes('pid:')) { \n  msg.payload=\"Process running\"\n}\n\nif (test.includes('kill')) { \n  msg.payload=\"Process stopped\"\n}\n\nelse {\n    msg.payload=\"unknow process status\"\n}\n\n\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1300,"y":480,"wires":[["cac9c0b90cab337b"]]}]

Thanks for helping

the middle test probably wants to be an else if .
Currently the first test may or may not set the payload... but then the second if will then overwrite that with the stopped or unknown message.