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

How to detect if an unmanaged native debugger is running the current .NET application?

How do I check if a C# program is being put into a debugger in C#? The OS is Windows 10. I have tried to check the user of the person running the program, but it always gave me the current user logged in. Does anyone have any ideas on how I can do…
0
votes
1 answer

How to pass a file (not from file system) to NodeJs child_process.exec command

I am using a wkhtmltopdf to generate pdf from html in nodejs child_process and i want to pass a css file to this command not from file system wkhtmltopdf --user-style-sheet cssfilepath -s A3 ${file.baseUrl}…
Ahmad bz
  • 1
  • 1
0
votes
0 answers

Nested NestJS servers

I need to run an NestJS server who can start and stop another NestJS server when accessing endpoints from the first one. An be able to stream the logs of the second one. I have no idea how to do that. I tried with child-process but it doesn't…
G .E
  • 21
  • 1
0
votes
2 answers

Node child_processes not executing concurrently

Background I want to navigate to multiple websites in separate browser tabs programmatically. Ideally, I want to be able to have these websites loading in parallel, when the code is triggered. Problem As a proof of concept, I have the following code…
artze
  • 511
  • 1
  • 4
  • 18
0
votes
0 answers

Node.js - Passing continuous stream of input to process.stdin

startServer = function(path) { console.log("Starting ..."); server = spawn("java", ["-jar", path], { shell: true, }); server.stdin.write("example-input"); server.stdin.end(); } I have the above (lightly edited)…
Tee1er
  • 33
  • 1
  • 5
0
votes
2 answers

waiting for two promises with events and loop

i have a piece of code like this: for(let j = 0; j < someNumber; j++) { const forkedChildOne = fork("./child.js"); const childOne = await new Promise((resolve, reject) => { forkedChildOne.on('message', (msg){ // someCode …
0
votes
1 answer

execSync and ffmpeg execution gap

I am not sure if this is a new question but search for 5 minutes doesn't yield any result. I want to use ffmpeg to capture 10 seconds mp4 blocks into files for my other program to post-analysis. Right now, in the code below. I will see 1-1.5 seconds…
Kenny Lim
  • 1,193
  • 1
  • 11
  • 31
0
votes
1 answer

What happens to active child processes when you fork a parent, do all active processes create another process ? Fork();

Bellow is the code of what is going on , and here is an image of what am i trying to do , any help would be appreciated.Trying to draw the diagram of all the processes Code: for(i=0;i<2;i++){ int pid = fork(); if(pid == 0){ fork(); …
Ivan
  • 1
  • 2
0
votes
1 answer

Capturing exit status of child process different on CentOS 6 and Ubuntu 20.04 (in Perl)?

I am adapting a perl backup script from CentOS 6 to Ubuntu 20.04. The subroutine ExecCmd() starts a child process for a system call to rsync. On CentOS 6 it populates a variable $ExecCmdOut with the rsync output and returns the exit status,…
0
votes
0 answers

exec() is unable to encode some characters correctly when calling CMD

See my minimal example: var { exec } = require('child_process'); var out; exec('echo oø', options={encoding: 'buffer'} callback=(err, stdout, stderr) => { out = stdout}); No matter the encoding configuration of exec options and…
Mathias Andersen
  • 478
  • 1
  • 4
  • 9
0
votes
1 answer

I can't get any error messages on node.js spawn, using ffmpeg

I am trying to get the errors from a spawn process on nodejs, trying to run FFMPEG. I have not run a child process before explicitly, so I'm not sure this is right, but what I have gathered from code examples online: const {spawn} =…
rickster26ter1
  • 373
  • 3
  • 10
0
votes
2 answers

Running Shell Script From Any Directory | NodeJs

I've come across an issue that I can't seem to fix. Take a look at the following snippet. I'm trying to get a shell script running to retrieve some data inside my CLI project. The issue at hand is that it fails to work in any directory other than…
user15349738
0
votes
1 answer

Impact of detached child process to master process NodeJS

I'm using child_process.fork in a NodeJS API server. Here's how I call it: const { fork } = require('child_process'); const dequeuingChild = fork('dequeue-child.js', null, {stdio: 'inherit', detached: false}); ... // inside some…
Mon
  • 1,010
  • 1
  • 11
  • 19
0
votes
1 answer

node - pass variable to child process

Is possible to pass a variable to a child process of a node cli script? For example: const child = require('child_process').spawn; const script = 'path/to/my/file.js'; const a = 'value'; // pass the variable a to child child('node', [script], {…
newbiedev
  • 2,607
  • 3
  • 17
  • 65
0
votes
1 answer

NodeJS subprocess.send() fails silently

I'm using child_process.fork() to spawn a child process, but calls from the parent to child via subprocess.send() fail silently (despite happening inside subprocess.on('spawn') callback); specifically, the child's process.on('message') does not…
Jakob Jingleheimer
  • 30,952
  • 27
  • 76
  • 126
1 2 3
99
100