Questions tagged [exec]

This tag refers to the starting of another, subsidiary program. It is named after the family of POSIX system calls whose name starts with “exec” (notably “execve”) though similar concepts exist on other platforms as well, especially when combined with the starting up of another process.

From The Open Group Base Specifications Issue 7

The exec family of functions shall replace the current process image with a new process image. The new image shall be constructed from a regular, executable file called the new process image file. There shall be no return from a successful exec, because the calling process image is overlaid by the new process image.

This tag is commonly used with when it refers to execute an external program within a php code.

Examples

echo exec('whoami');

References

5914 questions
2
votes
3 answers

Exec sproc from Powershell

I would like to execute a stored procedure from Powershell (v2) against a SQL Server 2008 database. Coming from using C# as my primary language, I'm doing it in that fashion. For example, when I need to run a sproc that doesn't return results, here…
Justin R.
  • 23,435
  • 23
  • 108
  • 157
2
votes
0 answers

Execute git commands with node.js synchronously

I'm currently writing a node.js module. I'm using var exec = require('child_process').exec; from the node.js api. But I have to execute 2 git commands with exec successively. I always get the following error message: exec error: Error: Command…
mybecks
  • 2,443
  • 8
  • 31
  • 43
2
votes
2 answers

Why does this code fail? child not waiting

Ok so I have been trying to learn to master child processes and properly waiting for them to finish. I have read a lot of Stack Overflow Q/A and I still can't seem to get this to work as I want it to. I have been reading/searching through the book…
dusz
  • 913
  • 1
  • 9
  • 15
2
votes
3 answers

How to run a large amount of python code from a string?

I need to be able to run a large amount of python code from a string. Simply using exec doesn't seem to work, as, while the code runs perfectly in a normal setting, doing it this way seems to throw an error. I also don't think I can just import it…
user1149589
  • 243
  • 3
  • 11
2
votes
2 answers

Really daemonize a command when using exec()?

From PHP pages of my apache server, I run some commands using a line like : exec("{$command} >> /tmp/test.log 2>&1 & echo -n \$!"); You can see an explaination of the arguments here. But I don't understand something : if I restart or stop my apache…
Alain Tiemblo
  • 36,099
  • 17
  • 121
  • 153
2
votes
1 answer

Why is Runtime.getRuntime().exec forking a process as root in Tomcat?

I am using Runtime.getRuntime().exec(...) to execute a python script from within a Tomcat webapp. Everything goes fine when I am in my development environment (Eclipse running my local Tomcat (located at /home/me/opt/tomcat) through the…
matthes
  • 2,972
  • 3
  • 15
  • 18
2
votes
1 answer

execvp - ls: fts_open: No such file or directory

I'm currently struggling with this error. I'm writing a shell emulator, using fork() for executing a command using execvp();. Almost every command I try to parse to my shell is working perfectly, except for ls without arguments. If I try to execute…
Arthur Camara
  • 578
  • 8
  • 19
2
votes
0 answers

Capture stdin, stdout, stderr of child process using pipes

I have to write program in C (Unix) which captures stdin, stdout and stderr of command passed in command line arguments. For example, ./capture echo Hi == stdout === Hi == end of stdout == ./capture bc -q == stdin == 1+2 == end of stdin == == stdout…
vralex
  • 251
  • 3
  • 7
2
votes
0 answers

Executing wkhtmltoimage from PHP hangs

Executing wkhtmltoimage from PHP it just hangs. $command = 'wkhtmltoimage --format "png" "' . $url . '" "' . $output . '"'; exec($command); It hangs until PHP times out. I can run the same command from the CLI directly and it works fine. I have…
Petah
  • 45,477
  • 28
  • 157
  • 213
2
votes
0 answers

Java run another class and control its I/O

I need to (compile and) run another class with main method in Java and read its output and later write into its input, but focus on reading first. Let's say i need to test wether the application writes "123" on standart output, here's how i magine…
kajacx
  • 12,361
  • 5
  • 43
  • 70
2
votes
1 answer

Setting permission for PHP (or I_USER [I'm not sure here...]) to connect to iisweb.vbs

I have been trying to figure out a way to manage our domains at work and easily created a SimpleDNS class, but now I'm on the IIS Server Administration side of it and I'm just lost on what is going on. Here is the PHP code I am running to test…
hatfieldajoshua
  • 307
  • 1
  • 4
  • 15
2
votes
3 answers

Splitting Unix command for use with exec

I have a program which takes command from input, and then executes it using execl (it has to be function from execvp family). Right now, assuming the input line is in , can I simply use execl(allBeforeFirstSpaceFromIn, in); , or do I have to divide…
Xyzk
  • 1,332
  • 2
  • 21
  • 36
2
votes
1 answer

How do i correctly utilize pipe, fork and execv to launch and interact with a secondary program?

Programming Language: C and C++ mixed code Context: There is program 'A' that takes user input from STDIN and outputs a response to STDOUT. The input and output of 'A' are unsuitable for my intended users. Unfortunately editing or augmenting 'A'…
Hooman
  • 31
  • 4
2
votes
0 answers

PHP exec tracert progressive display

Trying to display my results progressively, as it would be displayed in CMD. (ie: line by line) Not even sure where to start?
Dan
  • 23
  • 2
2
votes
3 answers

Read variables from two files and output in a pattern on 3rd file

I have 2 files like below: file1: a1,b1,c1,d1,e1,f1,g1,h1 a2,b2,c2,d2,e2,f2,g2,h2 a3,b3,c3,d3,e3,f3,g3,h3 a4,b4,c4,d4,e4,f4,g4,h4 file2: x1,y1,z1 x2,y2,z2 x3,y3,z3 x4,y4,z4 I want to read simultaneously from both and output the variables in a…
Marcos
  • 845
  • 3
  • 10
  • 21