exec

How to use _spawn or _exec for bootstrapping?

After writing the following program, it does not appear to pass arguments to the called application. While researching _spawnv and what it can do, _execvp was found as what appeared to be a suitable alternative. Does anyone see the problem in the source code and know what needs to be done to fix it? #include <stdio.h> #include <stdlib.h...

[Ant] How to export environment variable from exec task ?

Hi, I am using Ant under WinXp to build MSVisual c++ projects. To access "devenv.com", being computer-independent, I would like to use the vsvars32.bat script. Unfortunately, it seems that env vars are defined only in the "exec" scope. Example: <exec executable='"${env.VS90COMNTOOLS}vsvars32.bat/> <echo message="${DevEnvDir}" /> <ec...

exec() text redirection for PHP on Windows on SVN post-commit hook

I have been following the post below trying to hook my SubVersion installation to my Mantis bug tracker. How To Integrate Subversion and Mantis Everything works fine until the last line where it calls the Mantis checkin.php script and feeds it the message string that has been created in the script. exec(CHECKIN . " <<< \"$message\"");...

How do I change the shell for php's exec()

Hey, I want to use php's exec() function on an ubuntu server. The problem is, I alway get an error, that the command is not found. For example using exec("echo 123"); prints sh: /echo: not found To me, it looks like php is using the sh shell, when I want to be using bash. I tried changing the shell for www-data in /etc/passwd,...

PHP: Using SVN subcommands and options in exec() causes "segmentation fault"?

There is something that drives me nuts these days since I cannot continue my work on a project. I've switched to another computer and can't get PHP and svn executable to work together nicely :) $output = ""; $value = ""; exec("/opt/subversion/bin/svn info --username something --password something --non-interactive <REPO_URL> 2>&1", ...

Calling java program dependent on external library

I am trying to call a java program in php to use it with web interface. Java program is dependent on an external lib: commons-cli-1.2.jar So basically I need to export it before calling the java program; but if I export it first as: shell_exec('export CLASSPATH=$CLASSPATH:~/lib/commons-cli-1.2.jar'); then call the java program as: ...

"exec() has been disabled for security reasons" & "Undefined variable"

I found a cool MySQL backup script. It's working fine on some hosting companies. Now I'm trying it on a different host running PHP Version 5.2.8. I have a php.ini file that contains this (in both root dir and current dir): disable_functions =. I'm getting these warnings, and it seems like they are more than warnings. If the exec(...

When executing batch file from Java Runtime, native DOS commands fail to run

When I execute the batch file directly in DOS, everything runs as expected. But when I execute the batch file from Java runTime, it will run only the commands that invoke jar files (ie. invoke the JVM). It does not run any native dos commands. One problem is that I have no console to know why this is happening. I'm wondering if it's...

taskkill from PHP exec

Hello all, I have just tried to execute this: function kill_hr(){ exec("taskkill /IM uper.exe", $output = array(), $return); print_r($output); echo "<br />".$return; } However, the output is this and its not very useful: Array ( ) 1 When the process doesn't exist its this: Array ( ) 128 I am trying to work...

Get a remote FLV using PHP and curl

I want to know if it's possible to get a remote flv file and have it 'stream' using PHP and exec function. I have 'curl' in my environnement so i want something like : exec ('curl http://myhosts.com/myflv.flv', $out); print $out; Problem is that $out is returned as an array; i want to output the 'raw' stream returned by curl. ...

Syntax Error exec-ing python code from database

I'm loading some python code from a database (it's doing dynamic mapping of values that I can change at runtime without a code redeploy). In my code, I'm doing this to execute the database code: if lMapping: print lMapping exec lMapping lValue = mapping(lValue, lCsvRow) and here's the value of lMapping: def mapping(pValue, pCs...

PHP - What's the difference between escapeshellarg and escapeshellcmd?

PHP has 2 closely related functions, escapeshellarg() and escapeshellcmd(). They both seem to do similar things, namely help make a string safer to use in system()/exec()/etc. Which one should I use? I just want to be able to take some user input and run a command on it, and not have everything blow up. If PHP had an exec-type-function ...

While loop in Microsoft SQL Server 2008

I'm trying to come up with a simple example of a while loop using Microsoft SQL Server. Here I'm looping through all the tables that begin with the word temp. Declare @Object_ID int,@Name varchar(50) set @Object_ID = 0 while exists ( select * from sys.tables where type = 'u' and object_ID > @Object_ID and Name lik...

Adding tasks to Windows scheduler with PHP

Hi, I'm unable to find any information on adding tasks to Windows Task Scheduler with PHP. I can use exec(). This has to work on IIS. ...

bounce multiple servers using ant

Hi All, This is restart target code which is defined in build.xml target name="restart" propertycopy name="remote.host" from="deploy.${target.env}.host.${remote.id}" propertycopy name="remote.port" from="deploy.${target.env}.port.${remote.id}" sshexec trust="true" host="${remote.host}" port="${remote.port}" username="${scm.us...

Ant exec - cannot run program 'start' CreateProcess error=2

Hi I can't run the windows 'start' using ant exec. Ant version 1.7.1. Here is sample build.xml to recreate the problem <project name="test" basedir="." default="test-target"> <target name="test-target"> <exec executable="start"> <arg line="cmd /c notepad" /> </exec> </target> </project> getting t...

python import fails when called from PHP

I'm having a puzzling problem when trying to import a module in python only when the script is called from php via system or exec. From the python shell: import igraph #This works. if the previous line was in a file, say, test_module.py, then: python test_module.py in the bash works. Within PHP: exec("python test_module.py",$output,...

How do I parse a string representing a nested list into an actual list?

Say I have a string representing some nested lists and I want to convert it into the real thing. I could do this, I think: exec "myList = ['foo', ['cat', ['ant', 'bee'], 'dog'], 'bar', 'baz']" But in an environment where users might be supplying the string to execute this could/would be a bad idea. Does anybody have any ideas for a ti...

Ant task that processes multiple files

Hi, in Ant I want to execute a Java task on a fileset. I use the Java task to run rhino which runs a JS beautifier. The later works without any problems, except that it might seem little bit awkward to use rhino+js to acutally have a working JS beautifier/indenter. But all working JS beautifiers I have found are all written in JavaScript...

why my "eval" function doesn't work ,i think it can be print 'b',but not

a='''b="ddd"''' eval(repr(a)) print str(a) print b Please try to use the code, rather than text, because my English is not very good, thank you ...