# BUG in Node-RED 4.0.0 Exec node in spawn mode

**URL:** https://discourse.nodered.org/t/bug-in-node-red-4-0-0-exec-node-in-spawn-mode/89786
**Category:** General
**Tags:** exec
**Created:** [26 July 2024 11:41 UTC](https://discourse.nodered.org/t/bug-in-node-red-4-0-0-exec-node-in-spawn-mode/89786 "2024-07-26T11:41:09Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![jhamel](https://avatars.discourse-cdn.com/v4/letter/j/76d3ee/32.png) [@jhamel](https://discourse.nodered.org/u/jhamel)
#### Post date: [26 July 2024 11:41 UTC](https://discourse.nodered.org/t/bug-in-node-red-4-0-0-exec-node-in-spawn-mode/89786/1 "2024-07-26T11:41:09Z")

</div>

[flows.json](https://discourse.nodered.org/uploads/short-url/cchzNANe3pm52GkwnCGKkbzHUEL.json) (6.8 KB)  
[myText.txt](https://discourse.nodered.org/uploads/short-url/eaUxiXHg1QP4rwvisyoY1CGPK2z.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.

---

<div class="post-metadata">

### Author: ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)
#### Post date: [26 July 2024 12:08 UTC](https://discourse.nodered.org/t/bug-in-node-red-4-0-0-exec-node-in-spawn-mode/89786/2 "2024-07-26T12:08:15Z")

</div>

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

---

<div class="post-metadata">

### Author: ![jhamel](https://avatars.discourse-cdn.com/v4/letter/j/76d3ee/32.png) [@jhamel](https://discourse.nodered.org/u/jhamel)
#### Post date: [26 July 2024 12:21 UTC](https://discourse.nodered.org/t/bug-in-node-red-4-0-0-exec-node-in-spawn-mode/89786/3 "2024-07-26T12:21:24Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)
#### Post date: [26 July 2024 12:36 UTC](https://discourse.nodered.org/t/bug-in-node-red-4-0-0-exec-node-in-spawn-mode/89786/4 "2024-07-26T12:36:58Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [9 August 2024 12:37 UTC](https://discourse.nodered.org/t/bug-in-node-red-4-0-0-exec-node-in-spawn-mode/89786/5 "2024-08-09T12:37:37Z")

</div>

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