I'm new to node. I started building a simple web interface to control my simulation program written in C++. With the node program I'm creating config files and then start and stop the simulation. I want to use the child_process module to start my C++ simulation program. It's an real time simulation wich is clocked by an external signal from an IO. So it's time critical. Node and the simulation are running on a Raspberry Pi 3. The simulation results from the C++ program are being sent to a microcontroller over SPI. The microcontroller is doing some stuff and then puts out the simulation result in parallel to a power electronic and a digital-analog-converter for control purposes. I'm looking at the analog output with an oscilloscope. If I'm running my C++ simulation program standalone all is fine and the analog signal is as expected. If I'm running my simulation using node with child_process and the execFile method all is fine and the analog signal is as expected. If I'm running my simulation using node with child_process and the spawn method the simulation will output with some delays in between. I read that child.stdin.end() solves the problem, but thats not the case. So why is it that with spawn my child process is running slower? My second problem is that I want to do something with the spawned process. For that I need the PID of the process. But child.pid returns the wrong PID. In both cases with spawn and execFile. Best regards Dennis. |