child-process

Child process maximum limit

无人久伴 提交于 2019-12-25 01:10:02
问题 I want to compute the size of folder (i used readdirp module). For large folder the operation blocks my main thread so my electron application hangs. So i moved size computation process to forked child. since i have array of folders, i looping and forking new child process, on every iteration. These child Nodes are still whole new instances of V8. Assume at least 30ms startup and 10mb memory for each new Node. That is, you cannot create many thousands of them. I have studied somewhere. so how

python not working correctly when called from nodejs app with child-process

与世无争的帅哥 提交于 2019-12-24 19:52:38
问题 Im trying to run a python script that used deep learning model to classify an image wether it is NSFW or not, i use this script from here https://github.com/yahoo/open_nsfw and a custom model. The python script runs ok when called directly with python, but when called from nodejs app via child-process, the script stops at this line # Pre-load caffe model. nsfw_net = caffe.Net(model_def, pretrained_model, caffe.TEST) Everything else in python works fine. And the script run directly works fine

How to use tee command inside child process (exec)?

血红的双手。 提交于 2019-12-24 18:23:31
问题 I'm trying to use the tee command inside the exec, but I can't get any progress. My command converts a PFX to a PEM certificate using openssl like that: openssl pkcs12 -in MYCERT.pfx -nodes -passin pass:123456 | tee >(openssl pkey -outform PEM) >(openssl x509 -outform PEM) Terminal output: # first command output (PFX to PEM) Bag Attributes localKeyID: 1A 0F 62 99 24 06 E7 AE D7 0F 11... -----BEGIN CERTIFICATE----- MIIH+zCCBeOgAwIBAgIQXSw4HKLTQrztT3ENqlcWfjANBgkqhkiG9w0BAQsFADB4

Suspend a child process spawned by java

天大地大妈咪最大 提交于 2019-12-24 15:27:46
问题 I have a java program which uses Runtime.exec() to spawn a child process, but I need to be able to programatically suspend it and then start it running again from where it left off. The Java Process object doesn't seem to provide any way to do that. Does anyone know how I might accomplish this? Thank you 回答1: Under UNIX you can Runtime.exec + kill -STOP and -CONT to suspend and resume a process, without using JNI. 回答2: Java is not a low level language. Thus, some interactions with the

Cannot find module “shelljs” on including the lib in angular 2 typescript

烂漫一生 提交于 2019-12-24 13:52:43
问题 I want to include shelljs library to angular 2 typescript. I have included the shelljs.d.ts file to my node_modules/shelljs library. My package.json "name": "myproj1", "description": "myproj1: A project", "typings": { "shelljs": { "definitions": "node_modules/shelljs/shelljs.d.ts", "source": "node_modules/shelljs/global.js" } }, My webpack.config.js var path = require('path'); module.exports = { entry: './app/web/boot.ts', output: { path: path.resolve(__dirname, "js"), filename: "bundle.js" }

How to get console.log() output from the child process in “execa”?

倾然丶 夕夏残阳落幕 提交于 2019-12-24 13:00:15
问题 Below code starts Electron application, however, console.log() from the main process will not be available. import executeExternalCommand, { ExecaReturnValue } from 'execa'; async startInitializeProjectGUI(): Promise<void> { const executionResult: ExecaReturnValue<string> = await executeExternalCommand( 'electron', ['InitializeProject_GUI.js'], // console.log() is here { cwd: __dirname } ); if (executionResult.failed) { Promise.reject(new Error('Can not start "electron"')); } return; } How

Node - Prevent child process from going in to parent directory

浪子不回头ぞ 提交于 2019-12-24 09:09:47
问题 I am spawning a process from my node server, that is in /tmp/running/username (it is a node process uploaded by the user) how do I prevent it from reading (or knowing of the existence of) anything other than /tmp/running/username ? I can spawn the process in any required way. 回答1: You could spawn the process as an argument for chroot , which will change the root directory for your process: spawn('chroot', ['/tmp/running/username', 'yourprocess', 'arg1', ...]); An alternative would be to use

Nodejs how to check independently a process is running by PID?

这一生的挚爱 提交于 2019-12-24 05:09:08
问题 I'm using child_process to spawn a child process and get return PID from it. I will manage child process by its PID. Below is my code: const childProcess = require('child_process'); let options = ['/c', arg1, arg2]; const myProcess = childProcess.spawn('cmd.exe', options, { detached: false, shell: false }); let pid = myProcess.pid; During run time, I want to use PID to validate independently from outside if the process is running or not (finished / killed). I want to know how to do this and

Too many open files when using NodeJS child_processes.spawn to run scripts

戏子无情 提交于 2019-12-24 02:34:27
问题 Scenario: Using a master script to spawn a variable number of child processes a variable number of times in order to perform load testing against a server. The master script initially spawns all the children it can (according to its configuration settings) and then as the children processes exit if there are more runs requested by the config then new children are spun up. What I'm seeing is an immediate failure upon attempting to spin up the 83rd child process. 83? I'm not doing anything to

How to send control C node.js and child_processes

一笑奈何 提交于 2019-12-24 01:48:09
问题 Hello I want to send to the child_process, for example, ping 8.8.8.8-t, that is, an infinite number of ping. And some of the iterations I want to stop this command and execute a new, but in this case I do not want to kill a child process. Example: var spawn = require('child_process').spawn('cmd'), iconv = require('iconv-lite'); spawn.stdout.on('data', function (data) { console.log('Stdout: ', iconv.decode(data, 'cp866')); }); spawn.stderr.on('data', function (data) { console.log('Stderr: ',