spawn

How do I collect coverage from child processes when running `cover -test`, and not otherwise? (Devel::Cover)

只愿长相守 提交于 2020-01-14 10:42:37
问题 (I think I've seen the answer to this, but I can't find it again. The closest I have come across is this question). I am hacking on prt and am trying to get full coverage data for my changes. Some of my new tests call system($^X, 'prt', ...) to run child processes. I then test the output of those processes. However, Devel::Cover does not collect coverage data in the child processes. How do I collect that data, without causing Devel::Cover to run when I do a regular make test ? Currently I

expect: store output of a spawn command into variable

ぃ、小莉子 提交于 2020-01-07 03:53:06
问题 Inside my "expect" script: set $REPOS "/path/to/repo/" set $REV 73 set LOG [spawn svnlook log -r $REV $REPOS] What this will store in the variable "LOG": 16345 (memory location). What it should store in the variable "LOG": "some message of the svn commit log". It seems like the is a problem with executing a bash command and then storing that output into an expect variable. Have you got any ideas? I am new to expect and tcl. 回答1: You did't need spawn there. Try: set LOG [exec svnlook log -r

How to open/spawn a file with glib/gtkmm in Windows

£可爱£侵袭症+ 提交于 2020-01-05 05:27:15
问题 I've already tried: GError *pError = NULL; string uri = g_filename_to_uri(file.c_str(), NULL, &pError); if (!g_app_info_launch_default_for_uri(uri.c_str(), NULL, &pError)) { cout << "Failed to open uri: " << pError->message; } Here I get the error "URIs not supported". Is the uri I create here wrong? My second approach was to spawn the file with an asynchronous command line: file = quoteStr(file); try { Glib::spawn_command_line_async(file); } catch (Glib::SpawnError error) { cout << error

nodejs - Error: spawn ENOENT while adjusting image size using module gm

随声附和 提交于 2020-01-04 01:57:29
问题 I am trying to create a thumbnail with an image that I have already saved. I am using the module gm to adjust the size of the image. var gm = require ('gm'); var fs = require('fs'); var savedphoto = "./testphoto.jpeg"; var testdir = "./testoutput.jpeg"; gm(savedphoto) .resize(100, 100) .noProfile() .write(testdir, function (err) { console.error (err); }); When I run this I get the error spawn ENOENT . code: 'ENOENT', errno: 'ENOENT', syscall: 'spawn. How would I fix this problem? 回答1: Replace

Node spawn multiple shell process issues

早过忘川 提交于 2020-01-02 23:04:45
问题 I have developed a module to execute a generic command using the child_process spawn . I have two api in this module a single command execution api, CommandLine.execute and a multiple commands execution api, CommandLine.executeCommands , that I call in this way: // commandItemsArray is a list of commands list // that is an array of [command, options, arguments] commandItemsArray = [ ['ls','-l','./'], ['ls','-a','./'] ]; command.executeCommands( commandItemsArray , function(results) { console

Node spawn multiple shell process issues

柔情痞子 提交于 2020-01-02 23:03:02
问题 I have developed a module to execute a generic command using the child_process spawn . I have two api in this module a single command execution api, CommandLine.execute and a multiple commands execution api, CommandLine.executeCommands , that I call in this way: // commandItemsArray is a list of commands list // that is an array of [command, options, arguments] commandItemsArray = [ ['ls','-l','./'], ['ls','-a','./'] ]; command.executeCommands( commandItemsArray , function(results) { console

How to asynchronously collect results from new threads created in real time in ruby

﹥>﹥吖頭↗ 提交于 2019-12-25 07:37:26
问题 I would like to continously check the table in the DB for the commands to run. Some commands might take 4minutes to complete, some 10 seconds. Hence I would like to run them in threads. So every record creates new thread, and after thread is created, record gets removed. Because the DB lookup + Thread creation will run in an endless loop, how do I get the 'response' from the Thread (thread will issue shell command and get response code which I would like to read) ? I thought about creating

Option<Receiver> Moved in Previous Loop Iteration

落花浮王杯 提交于 2019-12-25 02:59:11
问题 I'm spawning a thread that does some work. Sometimes I want this thread to die after the work is finished, other times I want it to wait for more work to do. To do this I pass in an Option<Receiver<T>> . If Option<Receiver<T>> is None the thread should die, else it should wait to receive more work. fn foo(rx: Option<Receiver<usize>>) { thread::spawn(move || { loop { do_some_work(); if let Some(r) = rx { match r.recv() { Ok(x) => {} Err(_) => panic!("Oh no!"), } } else { break; //Die } } }); }

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

Why does Microsoft's _wspawnv return EINVAL?

核能气质少年 提交于 2019-12-24 05:48:52
问题 I'm calling Microsoft's _wspawnv function, and it keeps returning -1 with errno set to 22; errno.h defines this as EINVAL. According to Microsoft's documentation for _wspawnv, this code should only be returned if the mode parameter is invalid. I've tried calling it with _P_WAIT and _P_NOWAIT in the first parameter, and both return the same error. Edit: It's amazing how many problems can be solved by going away for a day. It didn't take me long to realize that the filename in the second