exec

java Processbuilder - exec a file which is not in path on OS X

Okay i'm trying to make ChucK available in exported Processing sketches, i.e. if i export an app from Processing, the ChucK VM binary will be executed from inside the app. So as a user of said app you don't need to worry about ChucK being in your path at all. Right now i'm generating and executing a bash script file, but this way i don'...

How to execute a program from file descriptor?

I need to execute a file when I only know the descriptor. It is also possible that there are no links to the file so finding out the name somehow is not an option. All the execve(), execvp(), etc functions take a file name. dlopen() also takes a name. Ugly solutions (like reading the file and calling some function pointer) are OK. ...

Enabling Console output for exec ANT task

Inside eclipse I'm launching an html page with a swf embedded from ANT using the following Macrodef: <macrodef name="runhtml"> <attribute name="url" /> <attribute name="browser" default="${app.browser.firefox}" /> <sequential> <exec executable="open" vmlauncher="true" spawn="false" fail...

First parameter of os.exec*

From the python docs: The various exec*() functions take a list of arguments for the new program loaded into the process. In each case, the first of these arguments is passed to the new program as its own name rather than as an argument a user may have typed on a command line. For the C programmer, this is the argv[0] ...

Javascript / jQuery Exec turns up Null

How do I skip over this next line if it turns out to be null? Currently, it (sometimes) "breaks" and prevents the script from continuing. var title = (/(.*?)<\/title>/m).exec(response)[1]; $.get(url, function(response){ var title = (/<title>(.*?)<\/title>/m).exec(response)[1]; if (title == null || title == undefined){ r...

Executing in java code an external program that takes arguments

Process p; String line; String path; String[] params = new String [3]; params[0] = "D:\\prog.exe"; params[1] = picA+".jpg"; params[2] = picB+".jpg"; try { p = Runtime.getRuntime().exec(params); BufferedReader input = new BufferedReader ...

How to remove adornments like [exec] when using groovy's AntBuilder

Hi! I'm using Groovy's AntBuilder to execute Ant tasks: def ant = new AntBuilder() ant.sequential { ant.exec(executable: "cmd", dir: "..", resultproperty: "exec-ret-code") { arg(value: "/c") arg(line: "dir") } } The output lines are prefixed by: [exec] Using Ant on the command line, this is turned off by "em...

Android: How to receive process signals in an activity to kill child process ?

My application calls Runtime.exec() to launch an executable in a separate process at start up time. I would like this child process to get killed when the parent activity exits. Now I can use onDestroy() to handle regular cases, but not "Force quit", shutdowns from DDMS, or kill from the console since those don't run onDestroy(). The add...

Ajax/PHP - should I use one long running script or polling?

Hello, I have a PHP script that is kicked off via ajax. This PHP script uses exec() to run a separate PHP script via the shell. The script that is called via exec() may take 30 seconds or so to complete. I need to update the UI once it is finished. Which of these options is preferred? a) Leave the HTTP connection open for the 30 se...

How to handle inputs in a C shell program during exec

I am currently writing my own shell program. This simple shell can just execute commands. When executing commands like vi or calc which require input from the terminal , the command is getting executed and is waiting for the input from the user. But I am unable to give any input on the screen. How should the input be handled during the...

PHP exec() not executing batch files

I tried googling for this issue and found many people with the same problem but no solution. $result = exec("C:\\Ruby191\\bin\\lessc.bat less\\$file", $output); Here result is an empty string and output an empty array. Same thing with: $result = exec("cmd /c C:\\Ruby191\\bin\\lessc.bat less\\$file", $output); I am sure the ...

Why first arg to execve() must be path to executable

I understand that execve() and family require the first argument of its argument array to be the same as the executable that is also pointed to by its first argument. That is, in this: execve(prog, args, env); args[0] will usually be the same as prog. But I can't seem to find information as to why this is. I also understand that ex...

Java - Runtime.getRuntime().exec() what's going on?

Hi, I have problem with Runtime.exec() in Java My code: String lol = "/home/pc/example.txt"; String[] b = {"touch", lol}; try { Runtime.getRuntime().exec(b); } catch(Exception ex) { doSomething(ex); } It's working good but when I trying changle variable "lol" files doesn't create in hard disk for instance: String...

Java respawn process

I'm making an editor-like program. If the user chooses File->Open in the main window I want to start a new copy of the editor process with the chosen filename as an argument. However, for that I need to know what command was used to start the first process: java -jar myapp.jar blabalsomearguments // --- need this information > Open File...

how to use a bash function defined in your .bashrc with find -exec

my .bashrc has the following function function myfile { file $1 } export -f myfile it works fine when i call it directly rajesh@rajesh-desktop:~$ myfile out.ogv out.ogv: Ogg data, Skeleton v3.0 it does not work when i try to invoke it through exec rajesh@rajesh-desktop:~$ find ./ -name *.ogv -exec myfile {} \; find: `myfile': No...

What is the PHP syntax for launching an ssh connection in the background?

I need to launch an ssh shell to a remote server for remote port forwarding in the background from a PHP script using the exec() function. The command when run in the background is $execStr, so I use exec($execStr ." > /dev/null &"); $execStr works fine manually, but not in the script. What is the correct syntax? Here is the rogue pro...

PHP Multithread CURL Capability Question

Hey Guys, I have a php script that comes down to the following: while ($arr = mysql_fetch_array($result)) { $url = $arr['url']; exec("curl $url > /dev/null &"); } $url will represent a remote script. My question is, what can I expect if I try to cycle through 2,000 URLs. Will opening that many CURL connections cripple my s...

PHP - How to run multiple commands in system, exec or shell_exec?

I'm trying to run shell command like this from php: ls -a | grep mydir But php only uses the first command. Is there any way to force php to pass the whole string to the shell? (I don't care about the output) ...

Problem with Runtime.getRuntime().exec("

Hi! I need to execute a command from a program. The command line is ok, I tryed it in the terminal, but it doesn't work in the program. I add a copy from my code: File dir = new File("videos"); String[] children = dir.list(); if (children == null) { // Either dir does not exist or is not a directory System.out.print("N...

How can I run a program in the background (non blocking) with php?

Hi, I want to run a shell script in php, but this shell script takes a long time to execute (it has sleep in it), I don't want the web server to block when executing this script. I tried exec() and shell_exec() in php but the server stops until the shell script finishes! I thought of doing fork in the shell script itself but I don't kn...