exec

Dynamic/runtime method creation (code generation) in Python

Hello, I need to generate code for a method at runtime. It's important to be able to run arbitrary code and have a docstring. I came up with a solution combining exec and setattr, here's a dummy example: class Viking(object): def __init__(self): code = ''' def dynamo(self, arg): """ dynamo's a d...

PHP exec() will not execute shell command when executed via browser

I have a certain PHP script that calls exec() to execute a command to convert a PDF to JPG. This command works fine in bash. To preempt your initial troubleshooting guesses, note the following: safe_mode = Off Permission on the directory containing the PDF and the script is set to 777, and this directory is also where the JPG is bein...

What is the difference between spawn and exec?

I'm learning to write a TCL (expect) scripts and I notice that some examples show to use spawn, while others show the command exec. I tried googling, but can't find what is the difference? Suppose I call 'exec' in a middle of a long expect script, what can I expect to happen? ...

Can't execute PHP script using PHP exec

I am trying to invoke a script which takes several seconds (web services with 3rd party) using the PHP exec call. After much struggling, I reduced this to the classic hello world example. The calling script looks like: exec('/usr/bin/php /home/quote2bi/tmp/helloworld.php > /tmp/execoutput.txt 2>&1 &'); When I run this, the output (ex...

Does any function from the exec family in unix not ignore SIGINT?

Is it possible to start a process with exec and have that process run in the background, and (unlike System()), will that process be killed once an interrupt signal is passed to the parent process that created it? ...

Using xcopy to copy files from several directories to one directory

Is it possible to use xcopy to copy files from several directories into one directory using only one xcopy command? Assuming that I have the directory tree root\Source\Sub1\Sub2 I want to copy all .xml files from the directory root\Source including sub folder to root\Destination. I don't want to copy the folder structure, just the fil...

msbuild exec task with for

I am trying to run the following commands as part of a msbuild script: for /R . %f in (*.targets) do copy /Y "%f" "C:\Program Files (x86)\MSBuild\Microso ft\VisualStudio\TeamBuild" The commands is implemented in an exec the following way: <Exec WorkingDirectory="$(SolutionRoot)" Command="for /R . %f in (*.targets) do copy /Y &quot;%f...

MS SQL SP - Working with EXEC recordset

Is there a way to work on a recordset returned from an exec within another SP? The whole recordset, preferably not using OUTPUT I.E. MyStoredProcedure @var1 int AS BEGIN EXEC anotherSP @var1 -- do something against the recordset returned by anotherSP END ...

SQL Server: Snapshot transaction problem with synonyms in Express Edition

We have 2 databases, say DB1 and DB2. DB1 contains all the stored procedures which access also data in DB2. DB1 uses synonyms to access the tables in DB2. (Using synonyms is a requirement in our situation) This works perfectly fine in all situations with SQL Server 2005 Developer Edition. However in the Express Edition, we get an excep...

Passing a pointer to process spawned with exec()

I would like to pass a pointer (I am putting a file with data in memory with mmap) to processes spawned using fork + exec, but I am stuck on how to pass a pointer to the exec() spawned process? UPDATE1: Thanks for your inputs, I do use shared memory creating it with mmap with MAP_INHERIT flag: Each mapped file and shared memory region...

Java: Executing a Java application in a separate process

Can a Java application be loaded in a separate process using its name, as opposed to its location, in a platform independent manner? I know you can execute a program via ... Process process = Runtime.getRuntime().exec( COMMAND ); ... the main issue of this method is that such calls are then platform specific. Ideally, I'd wrap a m...

Can I use execvp() on a function defined inside my program?

I have a C++ function that I'd like to call using execvp(), due to the way my program is organized. Is this possible? ...

Implement wait between processes in Java?

I would like some help understanding and implementing a 'wait until process complete' between the various processes in my application, which need to proceed in a step-wise fashion. My java file runs a batch file which then runs a script. At the conclusion of this there are series of commands that I need to run (through the command line) ...

How can I call awk or sed from inside a c program?

How can I call awk or sed inside a c program? I know I could use exec(), but I don't want to deal with fork() and all that other nastiness. ...

How do I execute a string containing Python code in Python?

How do I execute a string containing Python code in Python? ...

PHP @exec is failing silently

This is driving me crazy. I'm trying to execute a command line statement on a windows box for my PHP web app. It's running on windows XP, IIS5.1. The web app is running fine, but I cannot get @exec() to work with a specific contactenated variable. My command construction looks like this: $cmd = ($config->svn." cat ".$this->repConfig...

TSQL make EXECUTE statement synchronous

I have two TSQL EXEC statements EXECUTE (N'MyDynamicallyGeneratedStoredProcedure') -- return 0 on success SELECT @errCode = @@ERROR ; IF (@errCode = 0) BEGIN EXEC 'A Sql Statement using ##temptable created from first', @returnValue END How do I make the two EXEC's synchronous? ; Right now the second EXEC does not wait for the first...

bash to beep if command takes more than 1 minute to finish

Hi, I'm looking for my bash to beep, if the command i execute take more than a certain wall time ( say 1 minute ). if it keeps on beeping every few minutes there after till i hit enter or something .. that's greate. Any clever ideas ? I can use screen's monitor function as last resort. (I'm on cygwin, but that shouldn't mat...

How to create a UDF that takes a query string and returns the query's resultset

I want to create a stored procedure that takes a simple SELECT statement and return the resultset as a CSV string. So the basic idea is get the sql statement from user input, run it using EXEC(@stmt) and convert the resultset to text using cursors. However, as SQLServer doesn't allow: select * from storedprocedure(@sqlStmt) UDF with E...

How to add a timeout value when using Java's Runtime.exec()?

I have a method I am using to execute a command on the local host. I'd like to add a timeout parameter to the method so that if the command being called doesn't finish in a reasonable amount of time the method will return with an error code. Here's what it looks like so far, without the ability to timeout: public static int executeCom...