exec

exec() not returning process ID

时间秒杀一切 提交于 2020-01-05 07:36:42
问题 I'm using the PHP exec() function to execute the Canu assembler programs, and I want to get its process ID within the same script. The problem is exec() not returning any PID, even the process is running successfully. The processes are started like this: $gnuplot_path = '/usr/bin/gnuplot'; $command = 'nohup canu -d . -p E.coli gnuplot='.$gnuplot_path.' genomeSize=4.8m useGrid=false maxThreads=30 -pacbio-raw /path/to/p6.25x.fastq > /path/to/process.err 2>&1 &'; Currently, I try to determine if

exec() not returning process ID

☆樱花仙子☆ 提交于 2020-01-05 07:34:57
问题 I'm using the PHP exec() function to execute the Canu assembler programs, and I want to get its process ID within the same script. The problem is exec() not returning any PID, even the process is running successfully. The processes are started like this: $gnuplot_path = '/usr/bin/gnuplot'; $command = 'nohup canu -d . -p E.coli gnuplot='.$gnuplot_path.' genomeSize=4.8m useGrid=false maxThreads=30 -pacbio-raw /path/to/p6.25x.fastq > /path/to/process.err 2>&1 &'; Currently, I try to determine if

How redirection internally works in unix

。_饼干妹妹 提交于 2020-01-05 00:47:39
问题 Lets take an example : i have an executable named a.out. This contains binary information to print some text to STDOUT cos of printf. So when I give ./a.out, i see output of printf at the console STDOUT Say if i do './a.out > tempFile' in console. How does this work? Since there is printf inside a.out, ideally i except the text to be printed in STDOUT. How does redirection consume this text and why do we not see any output in console and only in the file we see the printf text 回答1: In UNIX,

PHP system() args

℡╲_俬逩灬. 提交于 2020-01-04 13:10:31
问题 I have the following code that executes a C++ program and outputs it : <html> <head> <title>C++</title> </head> <body> <div><?php system("app.exe", $out); echo rtrim($out, "0"); ?></div> </body> </html> How can I make it so that you can pass arguments to the c++ program , say like this... If this was the c++ program #include <iostream> #include <string> int main(){ string input = getarg();//Not really a function, just one I kinda want to know cout << input; return 0; } Could I do something

php exec() returning empty value

守給你的承諾、 提交于 2020-01-04 06:48:31
问题 Currently my goal is to use see the output of PHP exec() but getting an empty value. Am using firephp (firebug extension) logging and can't figure out why it is empty. full code here: https://github.com/MattMcFarland/ninja-forms-uploads-custom/blob/dev/uploads-custom.php Form here: http://www.hvac-hacks.com/?page_id=1383&preview=true&form_id=96 exec('mogrify -auto-orient -verbose -format jpg '.$dir."/".$user_file_name,$ouput); fb($output); curl_exec('mogrify -auto-orient -verbose -format jpg

nodejs wait for exec in function

可紊 提交于 2020-01-04 01:59:09
问题 I like to integrate exec from nodejs in a custom function to handle all the errors in this one function. const exec = require('child_process').exec; function os_func() { this.execCommand = function(cmd) { var ret; exec(cmd, (error, stdout, stderr) => { if (error) { console.error(`exec error: ${error}`); return; } ret = stdout; }); return ret; } } var os = new os_func(); This function returns undefined because exec isn't finished when the value returns. How can i solve that? Can i force the

Table variable and exec

为君一笑 提交于 2020-01-04 01:57:10
问题 How can I use a table variable while executing a command string? DECLARE @FileIDs TABLE ( File_ID int ) insert into @FileIDs select ID from Files where Name like '%bla%'; DECLARE @testquery as varchar(max); set @testquery = 'select * from @FileIDs'; exec(@testquery); returns the following error Msg 1087, Level 15, State 2, Line 1 Must declare the table variable "@FileIDs". 回答1: The table @FileIDs is not in the scope of exec(@testquery) . That's why you have that problem. To solve this problem

Restart Windows process inplace preserving process ID and handles

喜你入骨 提交于 2020-01-03 05:13:11
问题 I have created a windows executable that serves as a simulaator for some embedded device (all the business logic is exactly the same as on original device and only HW related stuff is stubbed). This simulation needs to reset from time to time, and in "normal" use case it does something like that: //some global environment ... int main(int argc, char* argv[]) { __debugbreak(); //... do some stuff //if( restart needed ){ printf("before _execv"); _execv(argv[0], argv); //"reset" simulated device

exec() keeps executing the command Again and Again like an infinite loop, despite of No loop in the program

こ雲淡風輕ζ 提交于 2020-01-03 04:35:44
问题 ADDENDUM: The problem in the question below is due to the SECOND command. When I comment out the second statement, the first one runs as expected and produces expected results. :s I needed to run two terminal commands from PHP SIMULTANEOUSLY, and nothing was solving my problem (as you can see here and here, if you want to). The first command is supposed to run Tshark for 5 seconds and capture network traffic (packets). The second command was supposed to generate some network packets and send

tcl: capture output from “exec diff” which returned non-zero

若如初见. 提交于 2020-01-02 10:02:56
问题 I know it is common to use catch when executing commands that may return non-zero... but how can I get the output in that case? To be specific, I wish to do something like "catch {exec diff fileA fileB} ret". The files are different and ret value is 1. What I actaully need is the output of diff, the detailed differences. But I believe the "catch {exec ...} err" practice does not provide it, right? Can someone please suggest on this task? Is there tcl-builtin commands to do file diff? (I think