external-process

How can I run an external program from C and parse its output?

I've got a utility that outputs a list of files required by a game. How can I run that utility within a C program and grab its output so I can act on it within the same program? UPDATE: Good call on the lack of information. The utility spits out a series of strings, and this is supposed to be complete portable across Mac/Windows/Linux...

How do I find out if a process is already running using c#?

I have C# winforms application that needs to start an external exe from time to time, but I do not wish to start another process if one is already running, but rather switch to it. So how in C# would I so this in the example below? using System.Diagnostics; ... Process foo = new Process(); foo.StartInfo.FileName = @"C:\bar\foo.exe";...

How can I read stderr when a command execution fails in Perl?

Hi, I am executing a diff command in perl. my @lines = `/usr/local/bin/diff -udr \"$expected_file\" \"$gen_file\"`; if ($? != 0) { print ERRFILE "Diff between $expected_file and $gen_file failed\n"; return $diff_err; } Here the diff might have failed because of some reason. For example: the stderr showed that /usr/local/bin/...

How to execute a .bat file from a C# windows form app?

What I need to do is have a C# 2005 GUI app call a .bat and several VBScript files at user's request. This is just a stop-gap solution until the end of the holidays and I can write it all in C#. I can get the VBScript files to execute with no problem but I am unable to execute the .bat file. When I "click" in the C# app to execute the .b...

ORA-28579: network error during callback from external procedure agent

Has anyone seen this error when trying to call an external C function from an Oracle query? I'm using Oracle 10g and get this error every time I try to call one of the two functions in the library. A call to the other function returns fine every time, though the function that works is all self-contained, no calls to any OCI* functions....

Blocking the standard error output of a programmatically run system command

I have this program in c++: #include <iostream> using namespace std; int main() { char buf[50]; cin.getline(buf,49); system(buf); return 0; } When I run and compile it and type for example "helo", my program prints the error: "helo" not found. Can I stop this error from being displayed? Is there any way to disable the error from...

How do I combine .EXE commands in Perl?

Hi I have a set of .EXE commands. How do I get all those commands run in Perl as a single file? Whats the process to call the .EXE files in Perl? ...

To Thread or not to Thread when starting an external application in C#

I'm creating a win service that monitors ftp logs, when a file has been uploaded I want to start an external application, like a powershell script, to do stuff with the file. my Question is do i want to spin this off into another thread when i do it or should I just wait until it finishes before moving on. This process is already goin...

How to call an external program in python and retrieve the output and return code?

Hi, How can I call an external program with a python script and retrieve the output and return code? ...

Running a program from within Java code..

Hi all, What is the simplest way to call a program from with a piece of Java code? (The program I want to run is aiSee and it can be run from command line or from Windows GUI; and I am on Vista but the code will also be run on Linux systems). ...

How do I launch a completely independent process from a Java program?

I am working on a program written in Java which, for some actions, launches external programs using user-configured command lines. Currently it uses Runtime.exec() and does not retain the Process reference (the launched programs are either a text editor or archive utility, so no need for the system in/out/err streams). There is a minor...

Start a process in low Priority. Is it possible without try-catch?

Not to long ago i asked about an error msg that occurred when when app.PriorityClass = ? was before app.start. Apparently the solution which i didnt like was to write it after start. It worked without much problem until today. I get a "Cannot process request because the process has exited." exception because the process completes quickl...

C# : Redirect console application output : How to flush the output?

I am spawning external console application and use async output redirect. as shown in this SO post My problem is it seems that the spawned process needs to produce certain amount of output before I get the OutputDataReceived event notification. I want to receive the OutputDataReceived event as soon as possible. I have a bare-bones...

PHP calls to external programs all fail with exit code 127

echo system("/usr/bin/whoami", $ret); echo $ret; PHP 4.3.9 on Apache 2.0.52, CentOS 4.5. Safe mode is off, I can run programs as the apache user account from the command line, but all programs run from PHP fail with exit code 127. ...

Create a WPF "control" that is run in an external process

I have a WPF app which contains a number of child controls. One of these controls hosts a third party library which underneath the covers runs some native code which throws access violations and crashes the application. Unfortunately removing the library is not an option. What I'd like to do is spin up a new windows process, host the t...

Unable to execute a program from a service

I have a Windows service which I want to periodically execute an external program. I'm currently doing this the usual way Process program = Process.Start(@"C:\mpewatch\db_parameters\DBParameters.exe"); This doesn't seem to be working. I'm executing this from a separate thread which is started in my service's OnStart handler. Is the...

Force external process to be killed after time period

I have a command line executable that is run from a C# class library. In some very rare situations the executable will hang because of the command line data passed to it. Unfortunetely this causes the application calling the c# DLL to hang whilst it waits indefinitely for the process to exit. If the command line exe doesnt finish execut...

Invoke external shell script from PHP and get its process ID

How can I invoke an external shell script (Or alternatively an external PHP script) from PHP itself and get its process ID within the same script? ...

python: run a process with timeout and capture stdout, stderr and exit status

Possible Duplicate: subprocess with timeout What is the easiest way to do the following in Python: Run an external process Capture stdout in a string, stderr, and exit status Set a timeout. I would like something like this: import proc try: status, stdout, stderr = proc.run(["ls", "-l"], timeout=10) except proc.Timeout...

How to launch and run extenal script in background?

I tried these two methods: os.system("python test.py") subprocess.Popen("python test.py", shell=True) Both approaches need to wait until test.py finishes which blocks main process. I know "nohup" can do the job. Is there a Python way to launch test.py or any other shell scripts and leave it running in background? Suppose test.py is ...