# Exec Spawn message break conditions

**URL:** <https://discourse.nodered.org/t/exec-spawn-message-break-conditions/87165>\
**Category:** General\
**Tags:** exec\
**Created:** [11 April 2024 15:23 UTC](https://discourse.nodered.org/t/exec-spawn-message-break-conditions/87165 "2024-04-11T15:23:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![PBn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pbn/32/90103_2.png) [@PBn](https://discourse.nodered.org/u/PBn)\
**Post date:** [11 April 2024 15:23 UTC](https://discourse.nodered.org/t/exec-spawn-message-break-conditions/87165/1 "2024-04-11T15:23:52Z")

</div>

Hello, I am trying to produce a fourier transform of some sensor data, an external python script is sampling a sensor, preforming a fft and trying to return some data at ~1sec intervals.  
I am spawning the exec (with the -u flag) but node red is sending several lines concatenated with new line characters instead of a separate message for every line.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/9/29658580da9f2672a58db88c3b03ceb73e5655a5.png)  
The docs say it "Usually" breaks into messages on new line characters. Under what conditions does the exec node break things into messages? Regardless of how many or few samples I set it to it seems to take about ~8000 characters and batch them into messages ignoring new line characters.

Edit:  
DietPi linux  
Node red 3.1.8

---

<div class="post-metadata">

**Author:** ![PBn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pbn/32/90103_2.png) [@PBn](https://discourse.nodered.org/u/PBn)\
**Post date:** [12 April 2024 20:18 UTC](https://discourse.nodered.org/t/exec-spawn-message-break-conditions/87165/2 "2024-04-12T20:18:44Z")

</div>

Node red seems to use nodejs process spawning [Child process | Node.js v21.7.3 Documentation](https://nodejs.org/api/child_process.html)

The output must be treated as a stream, for my function I will just need to deal with a few seconds of lag and use some function nodes to ingest the data.

If decide I want lower latency updates, would spawning a process and sending mqtt to a server on the device be a good solution?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [12 April 2024 20:50 UTC](https://discourse.nodered.org/t/exec-spawn-message-break-conditions/87165/3 "2024-04-12T20:50:44Z")

</div>

Likely MQTT is a better solution whether you want lower latency or not.

---

<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:** [11 July 2024 20:51 UTC](https://discourse.nodered.org/t/exec-spawn-message-break-conditions/87165/4 "2024-07-11T20:51:34Z")

</div>

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