child-process

NodeJS. Child_process.spawn. Handle process' input prompt

混江龙づ霸主 提交于 2019-12-23 19:04:20
问题 I'm currently working on my web interface for git. Accessing git itself by child_process.spawn. Everything is fine while there is simple "command -> response" mechanism, but I cannot understand what should I do with command prompts ( git fetch asks for password for example). Hypothetically there is some event fired, but I don't know what to listen to. All I see is " git_user@myserver's password: _ " in command line where node.js process itself is running. It would be great to redirect this

Unable to require('child_process').spawn, console says spawn is not a function, Python-Shell node package

人走茶凉 提交于 2019-12-23 17:50:13
问题 I am attempting to use an external package: npm install [python-shell][1] Right now, I have just the basic js file with the example the package comes with: console.log('hey in main.js') var PythonShell = require('python-shell'); PythonShell.run('./my_script.py', function (err) { if (err) throw err; console.log('finished running python script'); }); Along with my_script.py , etc When I start up the server, the console.log says: Uncaught TypeError: spawn is not a function Within the index.js of

Failed to launch child process

时间秒杀一切 提交于 2019-12-23 06:13:11
问题 When I try to run a test on Chrome (selenium / Ruby) then I get the following error. Could anybody help to resolve this? Error :- Background: Login to app # tests\integration\channels.feature:3 [6100:7920:1028/134946:ERROR:child_process_launcher.cc(533)] Failed to launch child process [6100:9520:1028/134946:ERROR:child_process_launcher.cc(533)] Failed to launch child process [6100:9520:1028/134946:ERROR:child_process_launcher.cc(533)] Failed to launch child process [6100:9520:1028/134949

Failed to launch child process

蓝咒 提交于 2019-12-23 06:12:26
问题 When I try to run a test on Chrome (selenium / Ruby) then I get the following error. Could anybody help to resolve this? Error :- Background: Login to app # tests\integration\channels.feature:3 [6100:7920:1028/134946:ERROR:child_process_launcher.cc(533)] Failed to launch child process [6100:9520:1028/134946:ERROR:child_process_launcher.cc(533)] Failed to launch child process [6100:9520:1028/134946:ERROR:child_process_launcher.cc(533)] Failed to launch child process [6100:9520:1028/134949

Node child process exits immediately after packing the electron app

北城余情 提交于 2019-12-23 05:00:26
问题 I have this piece of code in the GUI part of my electron app which works perfectly alright when run from the terminal. I have packaged the app using 'electron-packager', then I started getting some issue. Initially, the child process was terminating immediately and giving code 127 which I resolved by using 'fix-path' module as discussed here. https://github.com/electron/electron/issues/7688 Even after this, the process exits immediately with a code 1, I am unable to resolve this as there is

Kill process from node application

烂漫一生 提交于 2019-12-23 04:46:00
问题 I've used the following code to run some process which is working OK,my question is if there any option to kill this process on demand (by code) var exec = require('child_process').exec; var cmd = 'any command'; exec(cmd, function(error, stdout, stderr) { .... }); 回答1: var child = exec(cmd, function(error, stdout, stderr) { ... }); // When you want to kill it: child.kill(SIGNAL); See the documentation. 回答2: exec returns a childProcess object you can kill it using childProcess.kill([signal]) -

Node.js: Object value as stdout of child_process.exec

喜你入骨 提交于 2019-12-22 16:45:15
问题 I'm new to Node and stumbling on some of the nonblocking elements of it. I'm trying to create a object and have one of the elements of it being a function that returns the stdout of a child_process.exec, like so: var exec = require('child_process').exec; var myObj = {}; myObj.list = function(){ var result; exec("ls -al", function (error, stdout, stderr) { result = stdout; }); return result; } console.log('Ta da : '+myObj.list); I figure that myObj.list is returning result before it is set as

Node.js: Object value as stdout of child_process.exec

人盡茶涼 提交于 2019-12-22 16:45:01
问题 I'm new to Node and stumbling on some of the nonblocking elements of it. I'm trying to create a object and have one of the elements of it being a function that returns the stdout of a child_process.exec, like so: var exec = require('child_process').exec; var myObj = {}; myObj.list = function(){ var result; exec("ls -al", function (error, stdout, stderr) { result = stdout; }); return result; } console.log('Ta da : '+myObj.list); I figure that myObj.list is returning result before it is set as

Why can't Dart's “Process.start” execute an Ubuntu command when the command works in Ubuntu terminal?

安稳与你 提交于 2019-12-22 08:29:12
问题 I have command I would like to call with Dart. The command is sonar-runner which works perfectly if I run it in a normal Ubuntu terminal. This is because I have edited the PATH in the .profile file so it becomes a global command. However, if I wrote a simple Process.start code that should trigger the same thing: Process.run('sonar-runner', []).then((result) { stdout.write(result.stdout); stderr.write(result.stderr); }); I get as a response: Uncaught Error: ProcessException: No such file or

process.send is sync/async on *nix/Windows?

十年热恋 提交于 2019-12-22 05:31:42
问题 I have a Node.js process (not a server) that forks N child processes. At some point there might be more than 50 CPs. So I started thinking that if process.send (IPC) is truly blocking then this might be a big penalty experienced by each CP. Because what happens in my program is that each CP uses process.send to send a message to the single parent process so that the parent will do the logging, so that the logging will be synchronized. But if process.send blocks then at some point the parent