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
0 answers

No module named numpy when using child_process spawn in node.js express

I'm trying to run a python script with an input and an output when the user submits a form. The form activates the post function in express and I have used spawn of child_process to run the script. However, ModuleNotFoundError: No module named…
Alyssa
  • 23
  • 4
0
votes
1 answer

Spawn continuous bash command and wait for finished stream everytime

I want to spawn a bash command (top -b) that should run continuous in the background and should constantly deliver results. I would like to send an entire output to my front-end via a websocket, every time a complete output is delivered.…
borsTiHD
  • 253
  • 3
  • 17
0
votes
1 answer

Executing Command in Nodejs and Attaching the output to the console

I'm working on a CLI tool to add an extra layer of automation and utilities to our workflow and I'm wrapping the webpack development command with an alternative in my CLI (here's a demonstration):- function runDev(){ …
Ibrahim Rahhal
  • 323
  • 2
  • 9
0
votes
1 answer

Change Python version for spawned script in Node

Here in index.ts, I've spawned in the script using child_process and am wondering how I can specify which Python version should be ran with it, since it defaults to 2.7 (the one that came with my mac), rather than Python 3.9.6(64-bit) which is my…
Daggerpov
  • 127
  • 1
  • 13
0
votes
1 answer

How to set variable from child_process.exec()

I have a simple function to run a system app from the web. server.route({ method: 'POST', path: '/executeMain', handler: (req, res) => { var success = false; exec("./main", (error, stdout, stderr) => { if (error) { …
Baleeroon
  • 65
  • 1
  • 4
0
votes
1 answer

nodejs child_process scope issue

I am using child_process(fork) of nodejs then I send data to a particular file and receive data but not console that data after receiving of process execution first.js var cp = require('child_process'); var child =…
Piyush Jain
  • 313
  • 3
  • 10
0
votes
2 answers

How to package and execute a binary in background with cordova in android?

Trying to run an executable .so file with cordova in the background. I have a "lib" folder which contains the folders "arm64-v8a", "ameabi-v7a" and "x86_64" These three folders contain the executable .so file for the matching archetecture (arm…
user3776738
  • 214
  • 2
  • 10
  • 27
0
votes
0 answers

how can i use child process to call python script that depends on other python scripts in nodejs

i'm building an application using nodejs , and i need to call a python program which contains many files that depends on each other , so my question is , is child process useful in this siutuation or there are other ways to do this . Ps: and for…
justLearning
  • 59
  • 1
  • 7
0
votes
1 answer

node spawn_child to use different node version

I have a node script which runs Webdriver tests. I am using following code const procInfo = child_process.spawn('wdio', 0, pathModule.join(downloadDir, 'node_modules', '.bin', IsWin32 ? 'wdio.cmd' : 'wdio'), args, { cwd:…
Aamir Mahmood
  • 2,704
  • 3
  • 27
  • 47
0
votes
1 answer

How to get the output of command executed using child_process in nodejs?

I am new to node js, I want to execute a command in node js and want to display the running status of the command to the terminal and also to some log file. // Displaying the output in terminal but I am not able to access child.stdout const child =…
0
votes
2 answers

Waiting for stream input from child process in Node.js

My main Node.js process spawns a child process. I want to communicate to the child process by sending it data through its stdin and reading it out from its stdout. The child process will continue running. I want to send it a message, then wait for…
XSeven
  • 11
  • 1
  • 5
0
votes
0 answers

Child process not waking up after a sigsuspend (C)

I have to create a program that generates 2 childs and each of them has to generate a random number. After that the child who generated the lowest number has to send a SIGUSR1 to the other child. In my case i wanna send a SIGCONT to child 1 to wake…
0
votes
1 answer

Nodejs: Child_process.exec is not executing any commands also not getting any issue

I am trying to open file via node application for which I have used below code. const app = express() const port = 3000 const { exec } = require('child_process'); //var exec = require( 'child_process' ).exec; app.get('/', (req, res) => { …
0
votes
0 answers

How can I prevent a Node.js child process from running malicious code?

I have a module that uses child_process to run users' code (that I write to a file). I use the following to execute the code and return a stream of the child's stdout. Now I'd like to prevent users from entering malicious code, such as opening…
wenchin77
  • 45
  • 1
  • 6
0
votes
2 answers

Managing multiple processes within a NodeJS application

Let's say I'd want to control (start/stop) several other NodeJS scripts from within one "main" NodeJS app. However, not necessarly NodeJS Scripts exclusively, but also simple bash scripts. I'm looking into the following solution, using execa //…
turbopasi
  • 3,327
  • 2
  • 16
  • 43