Questions tagged [child-process]

For questions regarding child-process

In Unix, a child process is typically created as a copy of the parent, using the fork system call. The child process can then overlay itself with a different program (using exec) as required.

Each process may create many child processes but will have at most one parent process; if a process does not have a parent this usually indicates that it was created directly by the kernel.

The inter communication between a child process and a parent process can be done through normal communication schemes such as pipes, sockets, message queues, shared memories.

When a child process terminates, some information is returned to the parent process. When a child process terminates before the parent has called wait, the kernel retains some information about the process, such as its exit status, to enable its parent to call wait later

2233 questions
0
votes
1 answer

Restart an external process from within a nodejs app (linux)

Say that I am running a process from the command line (NOT a nodejs app): myProcess doSomething --withParam1 I am also running a nodejs app that connects to this process (rpc). node myApp myProcess will randomly silently fail to work properly…
Undead8
  • 182
  • 1
  • 11
0
votes
1 answer

C: multiple child process each generate different random number

I am trying to let children to process different random value EVERYTIME. If there is 3 children, I want them to generate 3 different random value each, so in total 3*3=9 different number. I've tried many srand(), if I go srand(time(NULL)) , all the…
Chocode
  • 147
  • 9
0
votes
1 answer

How to implement two-way communication between nodejs and a python subprocess

I've got a node.js application that needs to pass input to a python program and get the input back. This process needs to occur frequently and with as little latency as possible. Thus I've chosen to use the child_process package. The javascript code…
Ryan Keathley
  • 49
  • 1
  • 5
0
votes
1 answer

How to open already popped up command prompt using Child_process.exec

I am creating a child_process which will just open a command prompt whenever user click on a Button. If user clicks on the button 3 times. then 3 times a command prompt is created. Instead of creating 3 command prompt, I want to show the already…
Ranjan V
  • 21
  • 4
0
votes
0 answers

keep node child_process alive

I'm having issues keeping my node child process alive. I have one complex webserver running express in a typescript file index.ts // index.ts const app = express(); ... app.get("/path", doStuff()) I am able to spawn a fork of the file in a child…
0
votes
2 answers

How to kill node process in a electron application

I'm executing a node.js script that runs an express server when electron application window opens but when I close the app, the server still running which causes an error next time it opens up. Main Window process mainWindow.once('ready-to-show',…
Ibra
  • 912
  • 1
  • 12
  • 31
0
votes
1 answer

execSync - How to see ongoing script execution

I am using execSync to execute a shell script within a javascript script const { execSync } = require('child_process'); const shell = (cmd) => execSync(cmd, { encoding: 'utf8' }); shell('node jest'); When I run jest from my terminal, I see each…
Léo Coco
  • 4,022
  • 11
  • 52
  • 97
0
votes
1 answer

dynamic progress bar is not display correctly when execute wget by nodejs spawn

i write a node.js code just like below sample. i use child_process.spawn to create child process for execute command 'wget'. at the same time i redirec standard i/o of child process to standard i/o of node.js process let cp = spawn('wget',…
taccisum
  • 33
  • 6
0
votes
1 answer

Running git blame from Node's API

I'm building a VS Code extension which runs git blame as part of the process. I read that I can execute command line commands from JavaScript with Node's API, using a child process like this: var exec = require('child_process').exec; …
Esteban Vargas
  • 512
  • 1
  • 6
  • 24
0
votes
2 answers

How to wait for node exec response?

how can I use a callback tor a promise correctly to get the result from a node exec in the condole.log() function? import { exec } from 'child_process'; const check = () => { exec(`...`, (err, stdout) => { if (err) { return…
user17143939
0
votes
1 answer

Go up a directory to run a python script in parent directory, using Node Js Child Process

I am having issues figuring out how I can go up a directory from my server running to run a python script. I am able to run a python script using the child process, {spawn}, however, I am unable to go up once, to the parent directory to run the…
0
votes
1 answer

node child_process not firing message event

When I'm sending a message from parent.js to child.js in commonJs syntax then it works. In parent.js I have //parent.js const cp = require('child_process'); let child = cp.fork('./child.js'); child.on('message', (message) =>{ …
Arto Avag
  • 97
  • 2
  • 8
0
votes
0 answers

Wanted to know why doesn't the print statement in child process is not printing

#include #include #include #include #include #include int main(int argc, char *argv[]) { int rc = fork(); if (rc < 0) { printf("fork failed\n"); …
0
votes
0 answers

How to multi-thread child_process.exec() in Node.js?

I am currently building an application that uses child_process.exec(). The issue I am running into is, upon concurrent requests, maybe my exec()s are being queued and due to which the responses are extremely slow. How can I multi-thread exec() to…
Geralt
  • 1
  • 1
0
votes
1 answer

Module not found: Can't resolve 'child_process' while using Electron React Boilerplate

I am trying to use electron react boilerplate to make a desktop application. However, whenever I try to use python-shell, I get "Module not found: Can't resolve 'child_process'" in my directory. How can I fix this, or is it even possible to use…