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

child process is not working in electron app

I'm creating a child process using "fork" in the "electron" app. I'm creating child process as below: const child_process_file = path.join(__dirname, 'getSubFolders.js') const sub = fork(child_process_file, [JSON.stringify(subFolderObj),…
0
votes
1 answer

How to pass an array as input to awk in node child_process and output a text file

I'm thinking whether it is possible to pass an array as input of awk command via Node.JS child_process.spawn(). I'll explain myself with an example. Let's define an array (in my real case the array has about 3 million and something rows) : const…
Marco
  • 77
  • 1
  • 10
0
votes
0 answers

Arrival of message in child process is not displayed

I'd like to send a message from the parent process to one of the child processes (child). The message text is one of the three city names stored in an array of strings (cities). The array pointer is dynamically allocated at the beginning of the…
curiousMind_85
  • 167
  • 1
  • 8
0
votes
0 answers

Run NodeJS bat file and finish the process

I want to run a bat file with child_process module in NodeJS but I want the application to stop and the bat file to continue processing without waiting for the result of the application. Code I used: const { exec } =…
0
votes
0 answers

Trying to use concat de-muxer in ffmpeg to concatenate files with named pipes

I am trying to concatenate files with named pipes in node js using child process and ffmpeg. I tried to give the text input in this format: file 'pipe:3' file 'pipe:4' But this doesn't work as 'pipe' is not in the whitelist Then I added 'pipe' to…
0
votes
1 answer

How to use multiple stacks in Microsoft Azure? | NodeJS and Python

I have a nodeJS API which uses child_process to run a python file. I know heroku has a way to add another buildpack with a script. Is there a way with Microsoft Azure (web app / app services) to use NodeAPI and Python files in an App service. PS :…
0
votes
0 answers

I have node.js c ++, java, python compiler. in some cases it returns node.js error without any compiler error

I have node.js c ++, java, python compiler. in some cases it returns node.js error without any compiler error: enter image description here enter image description here works on the base and again I did not know the error is related to progress.kill…
0
votes
1 answer

Detach command from current shell

I have a nodejs server that executes commands through child_process.exec. One such command restarts the node instance (and a couple of other things). The script does something like this: kill node kill programs node uses clear logs restart programs…
beatgammit
  • 19,817
  • 19
  • 86
  • 129
0
votes
1 answer

Can't run terminal commands with exec

i'm trying to use exec function in nodejs, but it's not working. Here is the code that i'm runing : import { exec } from "child_process"; exec("ssh ubuntu@myserverip", (error, stdout, stderr) => { if (error) { console.error(`error:…
0
votes
1 answer

Why is sleep in a child process blocking my program?

So I have this simple program that sleeps for 4 second if the value returned by fork is '0' meaning that the child process is executing, I've tried using sleep in child process but the program is blocked, and flushing standard output isn't…
Farouk Hamadi
  • 31
  • 1
  • 8
0
votes
1 answer

how to run multiple infinite loops without blocking each other node.js?

I need to run multiple parallel tasks (infinite loops) without blocking each other in node.js. I'm trying now to do: const test = async () => { let a = new Promise(async res => { while (true) { console.log('test1') } }) let b =…
Alexxosipov
  • 1,215
  • 4
  • 19
  • 45
0
votes
0 answers

How to kill a python process that is previously spawned by 'spawn' in nodeJS?

I am currently figuring out how I can kill a process(tree) but I can not find a working solution. My System is Windows 10. I tried many things, but not a single one works. Here is my code: const { spawn } = require('child_process'); const kill =…
swftowu69
  • 123
  • 1
  • 9
0
votes
2 answers

How do I run a Python script within a JavaScript file

I am using React.JS to create a website, and I have a button that the user can press that will trigger some python file to be run. I've tried using child_process, but I get a ton of errors that I can't seem to find the answer to. Can anyone tell me…
0
votes
1 answer

c# - elsa workflow - child workflow - how to get workflowInstanceId of parent workflow

I have an elsa workflow parent which is calling some child workflows. Every child workflow has some custom activities (based on SendHttpRequest elsa activity). These custom activities need to call an external api and provide the workflowInstanceId…
Octavian
  • 15
  • 2
0
votes
0 answers

I am try to running child process fork with typescript from the dist folder but it's not working without using ts-node

hello everyone I am building a typescript node app and I was trying to change my code to use ES7 instead of CommonJs because I need to make my code run only using the dist folder "typescript output" as a pure javascript project even if my typescript…