BUG in Node-RED 4.0.0 Exec node in spawn mode

flows.json (6.8 KB)
myText.txt (7.2 KB)

I ran into an issue I didn't have in previous version of Node-RED (3.1.5).
When using the exec node in spawn mode, if an appended parameters via the payload contains a space in the path for a file, the calling thrid party program errors out. Yes, I have double-quotes surrounding said path.

Now for obvious reason, I cannot provide the whole setup and third party program but I reproduce the undesired behavior with the common Windows cmd type.

Save the attached myText.txt file to the following path: "C:\Test Space" and "C:\TestSpace".

Using the attached flow, simply trigger each one. Notice that each execute as expected and produce the content of the text file, as seen in the debug node named TOP.

In each exec node named type, change the output from exec mode to spawn mode.

Again trigger each one. Notice that the first one will error out with:

The system cannot find the file specified.
Error occurred while processing: C:\Test.

And the second one will execute properly. If you look at the debug node named Params, notice that the extra paramters are passed properly. If you try the same param directly fom a CMD window calling the type command, it works fine.

Like I said, the type command is not what I use in my real flow but I end-up with the same problem. I soon as I remove the space in the path, it starts working like a charm.

Your flow runs without error on my Windows 11 PC, Node-red vv 3.1 and 4.0.2

Even after you changed the output from Exec mode to Spawn mode, in both flows?

I run this on a Windows Server 2019 using Node-RED 4.0.0

I just reproduced it again on a Windows 10 22h2 vm using Node-RED 3.1.9

Maybe it has been fixed in 4.0.2?

Ah, I see, I assumed that the flow you posted was the one which causes the error.
Sloppy reading of your initial post, sorry!

I do see the error in spawn mode.

Putting quotes around part of msg.payload.execParam feels wrong to me, as does not escaping the space in the filename. But I'm not a Windows person so can't sensibly comment.

Does C:\"Test Space"\myText.txt | more work for you?

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.