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

Node.js Piping-how to write?

I need to figure out how I can give exec permissions to write. var exec = require('child_process').exec; exec('ffmpeg -i file.ogv -f mp4 file.mp4', function(err, stdout, stderr){ }); // ffmpeg converts one video file to another. How can I do this?
Jeremy Rubin
  • 567
  • 1
  • 7
  • 13
0
votes
0 answers

AWS S3 CLI error when file name contains parentheses

I'm running on Node and using child_process In order to perform aws s3 cp command. import { spawn, ChildProcess } from 'child_process'; /// some logic const s3Cp = (source: string, target: string) => { logger.info(`starting s3 sync. source :…
David Faizulaev
  • 4,651
  • 21
  • 74
  • 124
0
votes
1 answer

Spawn child process, then later send argument to that process

I want to spawn a child process, and then at a later time send an argument to it that will then execute. How can I do that? (NodeJS, on Mac) For example, I have a command to execute a script file: osascript script-test.scpt This command works in…
SeanRtS
  • 1,005
  • 1
  • 13
  • 31
0
votes
2 answers

How to interrupt child_process by a command given by parent process?

I am currently working on a project which requires the user to click on an 'execute' button to call a child_process in the backend for executing a time-consuming task. Codes are as follows, let child = child_process.spawn(//args); let data = ''; let…
0
votes
0 answers

NodeJS child_process: different results when using spawn and console

I'm trying to compress an image with pngquant. Here is the code: let output = ''; const quant = cp.spawn('pngquant', ['256', '--speed', '10'], { stdio: [null, null, 'ignore'], }); quant.stdout.on('data', data => output += data); …
Efog
  • 1,155
  • 1
  • 15
  • 33
0
votes
1 answer

How can I save the value of pid in a data structure and access it later with fork()?

I have a program where I am creating several different child processes to simulate a shell script. What I am doing if the process should be ran in the background is creating a child process, then storing it's process id in a database so that next…
0
votes
1 answer

Audio file input from node file to python file

I want to upload a .wav file from react frontend to node server and then send the file to a python file for speech recognition. I used multer to get the file in the post route. The file I get looks like this. { "fieldname": "file", …
0
votes
1 answer

How to get rid of " error: SPAWN ls ENONET on Windows "?

I don't know why this error occurred "error: SPAWN ls ENONET"
0
votes
0 answers

Sending KeyboardInterrupt to child process

Is there a way to raise an exception in the child process when the main process gets an KeyboardInterrupt exception (instead of a loop polling for an event or queue value)? For now I am using a Queue to communicate the KeyboardInterrupt triggered in…
Mat90
  • 169
  • 1
  • 9
0
votes
0 answers

how do I wrap a program with a parent process so that I can restart in nodejs?

I've got an application on a Replit REPL and can't get it to restart. If you open the shell tab and run node start.js than it makes a childProcess to wrap the main thing. This is mostly to be able to restart by running process.send("rs"). All code…
0
votes
1 answer

How can I create a child process from a command line input

If I input this command onto a Linux terminal, and lets say ./loop is a C program that I've compiled. (./loop is just a program that prints 'hello world' for n amount of times) $time ./loop 8 I'm looking to take this command line input of ./loop 8,…
TheKingSid
  • 39
  • 6
0
votes
0 answers

From Electron main file how to call a function in another concurrent project

I have my project structure as follow. Main Project -Project A(Electron + React) -node_modules -package.json -src -public -electron.js -Project B(Terminal based) -node_modules -package.json -src -lib …
user10518298
  • 169
  • 1
  • 16
0
votes
1 answer

ffmpeg --help, node child_process spawn trigger stderr

So I simply run ffmpeg --help using node.js, why is there stderr? I think it should be only stdout. Is it an issue of ffmpeg or node.js? Code: import path from 'path'; import {spawn} from 'child_process'; const childProcess =…
Tyler Liu
  • 19,552
  • 11
  • 100
  • 84
0
votes
1 answer

How to handle infinite loop error javascript

I have a auto-created JS file. And my module call it, some time the auto-created JS file cause infinite loop. And i will call thousand of auto-created JS file, some will run correct but some will cause infinite loop and I will don't know about file…
0
votes
1 answer

Synchronize spawn and stream event output NodeJS

I want to run set of test scripts using NodeJS, It outputs test results while executing. I want these different tests scripts to run synchronously and also output the results while execution. I tried using the spawnSync() function of child process,…
Harry Manoharan
  • 181
  • 1
  • 12