exec

Composer.phar don't want to run by shell_exec from PHP script. Why?

微笑、不失礼 提交于 2020-08-19 12:21:43
问题 Trying to execute it with all possible params, such as -d and full path etc.. No errors. When running another commands, all is ok, when running composer from CMD, all is ok too. Have tried exec, system, shell_exec etc.. What it could be? echo system('php composer.phar install'); 回答1: Try outputting the error stream as well: system('php composer.phar install 2>&1'); It might give you more of a hint as to what is going wrong. 回答2: Try this $path = 'path where, composer.phar and composer.json

nodejs exec command failing with no useful error message

自闭症网瘾萝莉.ら 提交于 2020-07-05 06:35:31
问题 This is the code to execute cp.exec("cc -Wall /tmp/test.c -o /tmp/test", function(e, stdout, stderr) { if (e) { var errorstr = "Compilation failed with the following error "+ e.message.toString() client.send(errorstr) console.log(e, stdout, stderr) ee.prototype.removeAllListeners() } else if (stderr.length > 0) { client.send("Compilion finished with warnings\n"+ stderr + '\n') client.send('compiled') ee.prototype.emit('compiled') } else { client.send("Compilation successful") ee.prototype

sanitize user input for child_process.exec command

旧街凉风 提交于 2020-06-13 19:32:05
问题 I'm writing a CLI using node and I've arrived at the part where I take user input and append it to a string that is the command for the child_process.exec function. const CURL_CHILD = exec('npm view --json ' + process.argv[2] + ... I am trying to figure out what I need to do to process.argv[2] before I pass it to the exec function. I've surfed around for a while and haven't found any questions or answers that address this specific case. What is the best way to sanitize this user input for

how to use threads and tee to log the telnet response from a server?

一个人想着一个人 提交于 2020-05-27 09:28:11
问题 context: there are distinctions between different telnet clients, and certainly a distinction from those clients to, for example, the Apache library. In this case, yes, using an actual telnet client for MUD's, where the servers can be quite finnicky, so that API's or sockets just won't work. How do I go about: Spawn a new Process for every piped command. Create Threads that read the output from one command and write it to the input of the next command. right now there's no output for: package

how to use threads and tee to log the telnet response from a server?

落花浮王杯 提交于 2020-05-27 09:25:31
问题 context: there are distinctions between different telnet clients, and certainly a distinction from those clients to, for example, the Apache library. In this case, yes, using an actual telnet client for MUD's, where the servers can be quite finnicky, so that API's or sockets just won't work. How do I go about: Spawn a new Process for every piped command. Create Threads that read the output from one command and write it to the input of the next command. right now there's no output for: package

Go build & exec: fork/exec: permission denied

筅森魡賤 提交于 2020-05-13 14:27:32
问题 I need to build a program using the Go toolchain and then execute it. For some reasons I get a permission error due the forking. Is there a way to circumvent this error or any best practice? I think my program does something similar with Go test tool, though go test doesn't get this kind of error. package main import( "os" "os/exec" "flag" log "github.com/golang/glog" ) func main(){ flag.Parse() tdir := "abc" if err := os.MkdirAll(tdir, 0777); err !=nil{ log.Error(err) return } f, err := os

How to safely use exec() in Python?

北慕城南 提交于 2020-05-10 21:05:14
问题 I have been tasked with building an application where an end user can have custom rules to evaluate whether a returned query results in a warning or alert (based on there own thresholds). I've built a way for the user to template their logic. An example looks like this: if (abs(<<21>>) >= abs(<<22>>)): retVal = <<21>> else: retVal = <<22>> The <<21>> and <<22>> parameters will be substituted with values found earlier in the program. Once all this substitution occurs I have a very simple if

How to safely use exec() in Python?

风流意气都作罢 提交于 2020-05-10 21:04:48
问题 I have been tasked with building an application where an end user can have custom rules to evaluate whether a returned query results in a warning or alert (based on there own thresholds). I've built a way for the user to template their logic. An example looks like this: if (abs(<<21>>) >= abs(<<22>>)): retVal = <<21>> else: retVal = <<22>> The <<21>> and <<22>> parameters will be substituted with values found earlier in the program. Once all this substitution occurs I have a very simple if

No code will run after `exec` in bash script [duplicate]

点点圈 提交于 2020-04-18 03:50:29
问题 This question already has answers here : My shell script stops after exec (3 answers) Closed 26 days ago . Sample bash script where I'm testing using variable expansion in command names: test_command_w_variable_expansion_in_name.sh : #!/bin/bash # Gabriel Staples # 21 Mar. 2020 echo "PATH = \"$PATH\"" # PATH="$HOME/bin:$PATH" # echo "PATH = \"$PATH\"" # 1st, create a command in ~/bin to test here mkdir -p ~/bin echo -e "#!/bin/bash\necho \"This is a test script found in ~/bin.\"" > ~/bin/gs

Go: Run External Python script

心已入冬 提交于 2020-04-11 05:43:06
问题 I have tried following the Go Docs in order to call a python script which just outputs "Hello" from GO, but have failed until now. exec.Command("script.py") or I've also tried calling a shell script which simply calls the python script, but also failed: exec.Command("job.sh") Any ideas how would I achieve this? EDIT I solved following the suggestion in the comments and adding the full path to exec.Command(). 回答1: Did you try adding Run() or Output(), as in: exec.Command("script.py").Run()