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

How to kill nodejs child processes which execute python commands including activating and deactivating venv

I'm new to using child process module in nodejs, and got stuck while using python's virtualenv libs I have a post route in an expressjs api, which is intended to activate a python virtualenv, run python on exec() child process and deactivate the…
Sai Kiran
  • 61
  • 7
0
votes
1 answer

Unable to serially execute ```execFile()``` with ```ffmpeg-static-electron``` binary Electron

I'm trying to split a number of .mp4 videos into .jpg images. The set up is using electron-react-app. I have used a preload script to enable access to limited functions with the React components. Problem: Unable to serially execute the call to…
0
votes
1 answer

How to reuse Redis connection using nodeJs childProcess

How could I reuse the redis connection in processes created using Childprocess.fork() in nodeJs ? For example, I would have a redis-config.js file where I create an instance of RedisClient and connect to the redis server. So after that I would have…
NerckJF
  • 59
  • 5
0
votes
0 answers

Child Process is killed after Node.js Application is restarted or killed

I want my processes to remain their existence if Node.js application is killed or restarted but they are killed after my application restarts itself. I've created the code below thanks to this article: Check here but it didn't work for me. I am…
0
votes
0 answers

Node async operations on child_process are not ending

I have a little script that executes a childprocess using execFile. This child process is a node script too that runs async operations but it seems like that the async are never ending so the terminal and all the processes are on hold. This is the…
jcobo1
  • 1,065
  • 1
  • 18
  • 34
0
votes
2 answers

Reading files when spawning a child process when the current directory is not the executable directory

Edit 1: This is NOT a duplicate of this question because that person wants to know how to get the executable path. I can get the path just fine, I'm just wondering if there's a more convenient way of USING the path without modifying hundreds of…
Kinjo
  • 43
  • 1
  • 7
0
votes
1 answer

Communication between parent and child results in system lockup

I am trying to create some communication between two programs by forking in the child program within the parent program. When I execute the child program separately, it works. The purpose of it is that if someone types 1, 2, or 3 followed by enter,…
Mike
  • 9
  • 2
0
votes
1 answer

Run a script when API endpoint is hit, and check if that script is running when hit again - Node.js

I'm working on a node.js API that needs to start/run a time-intensive javaScript file when a certain endpoint is hit. I've got this working, but what I'm now looking for is a way to stop the script from running again if it's already running and the…
Knight Steele
  • 169
  • 4
  • 14
0
votes
1 answer

Write to stdin of spawned child_process while it can be separately stopped

For a CLI parent process, I have a child process that I need to write some data to before it is stopped (e.g. WebSocket close code other than 1006). This snippet represents what I'm doing: setInterval(() => child.stdin.write("ping\n"), 1000); const…
Herman
  • 1,534
  • 10
  • 16
0
votes
1 answer

How to bundle python code with vsix (vscode extension)

I am creating a vscode extension where I need machine learning tasks to be performed. I have python files that have code that is required in vscode extension. I don't want things to be done using request-response on any python server. What I want is…
0
votes
1 answer

Unable to read child stderr twice in Rust

For some reason, I am unable to read from the child process stderr the second time. Here is what I do. I am spawning a child process for cucumber tests. In the first step I spawn the process, take its stderr, save it, and then read from it. Here is…
kasom
  • 43
  • 4
0
votes
2 answers

Node: spawn a command and print results to a file

If I want to list the files of a directory and save the results in a res.txt I can run the command ls -l > res.txt Now I would like to do the same in a process spawned from the main process of Node. I have tried naively this spawn( 'ls', ['-l',…
Picci
  • 16,775
  • 13
  • 70
  • 113
0
votes
1 answer

How to solve error on child_process execFile in Node

In my application I run an external MapInfo Program. In general it works fine, but I get an error and I have no idea how to solve it. const util = require('util'); const execFile = util.promisify(require('child_process').execFile); const mbxs =…
Wernfried Domscheit
  • 54,457
  • 9
  • 76
  • 110
0
votes
1 answer

How to properly handle the stdio of a spawned child_process?

I was working with child processes. I am making a game (which is pretty much in its last stages of completion) and now I have discovered a serious issue. Basically, In the game, I have a javascript based server that uses child_process to spawn a…
Hokkyokusei
  • 1,021
  • 13
  • 18
0
votes
1 answer

Node child_process answer +1 questions from prompt

first of all, sorry if this is a duplicate. Couldn't find a solution that worked for me. I'm implementing a CLI tool based on node and have one of my tasks which asks the user to enter some information based on an initial parameter that the user has…
BalB
  • 107
  • 1
  • 13