processes

Alternatives to popen/pclose?

I'm writing a program that has to execute other external processes; right now the program launches the processes' commandlines via popen, grabs any output, and then grabs the exit status via pclose. What is happening, however, is that for fast-running processes (e.g. the launched process errors out quickly) the pclose call cannot get th...

Executing a process on separate thread results in System.IO.__Error.WinIOError

I'm writing a basic GUI application that essentially invokes other processes given some parameters, while the output of those applications is displayed to the user via a richtext box in real-time. So basically I have a seperate process thread running the child processes. Most of the processes work fine on that thread, except for xdiscbl...

How can I get the memory usage before, after and of an individual spawned process in Python?

I have spawned a process using: ps = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE).communicate()[0] I want to do 3 things: 1) Get the memory usage of the Python script before the call to subprocess.Popen 2) Get the memory usage of the Python script after the call to subprocess.Popen 3) Get the memory usage of the spawned ...

Detecting if a process is still runnning

I need to check if a process with a given HANDLE is still runnning, I tried to do it using the following code however it always returns at the second return false, even if the process is running. bool isProcessRunning(HANDLE process) { if(process == INVALID_HANDLE_VALUE)return false; DWORD exitCode; if(GetExitCodeProcess(pr...

running processes step by step

Hi all, I need to install mysql in my system in the first step After installing or modifying the mysql in the system , I need to the run the data base scripts. The problem here is db scripts started running before mysql setup completes. I have tried different ways.. using auto run methods...using processes etc can anybody tell me ho...

What does light weight process mean?

Threads are light weight processes, what does it mean? ...

Monitoring a process in Windows

How can I monitor a Windows process and start it up if it is not running? I'd like to have something that starts up as a Windows service and can handle multiple processes. EDIT: Hopefully there's a ready to use library/component I can use and just tweak or configure instead of having to implement it from scratch. I know in the *nix worl...

On Terminal Server, how does a service start a process in a user's session?

From a Windows Service running on a Terminal Server (in global space), we would like to be able to start up a process running a windows application in a specific user's Terminal Server sessions. How does one go about doing this? The Scenerio: the windows service starts at boot time. After the user has logged into a Terminal Server user...

Start a multiple process in code and distinct them at their commandline arguments

I am running a service program which is started multiple times with different configuration files passed on commandline. The program is started by a control program which is running as windows service. This service should be able to monitor and restart the programs. At the moment i have the problem if the control program crashes, i can ...

Attach child process to debugger automatically

If the main process is currently being debugged in Visual Studio, how can I have it so any new processes it spawns are also attached to the same instance of Visual Studio as the main process is? Currently the new processes are created just with a CreateProcess call, however I can add extra code or use a different API altogether if neede...

On Windows, using C++, is there a way to tell an application to safely exit?

Right now, I'm using: TerminateProcess(pi.hProcess, 0) ... but this doesn't allow the application to clean up. Our application has a wndProc function, but when I send WM_CLOSE... PostThreadMessage(pi.dwThreadId, WM_CLOSE, 0, 0); The function doesn't seem to be getting the message. pi is of type: PROCESS_INFORMATION ...

How would I handle a close request for in a non-windowed application?

I'm working on a C++ Windows application, that runs as a process but not a windowed application (does not have WndProc). It has it's own message loop, which is used to process a quit message, and that's how we safely exit the application from within it's self. What I want to do is somehow send a message to the process from another proce...

Launch a child process on OSX/Unix that doesn't inherit files/ports

I want to launch a child process on OS X such that the child process does not inherit the current process's open files/ports. Any suggestions on how to accomplish this? Shell commands that I can invoke using the system() function would work too - I just don't know of a good shell command that enables this. Thanks! ...

Why is conhost.exe being launched?

I'm launching a Java process ("java.exe") from .Net. using Process.Start(). In addition to the Java process, another process called conhost.exe is launched somehow. I am redirecting the output from the Java process to the .Net process. Why is conhost.exe even launched? How do I track it from .Net? I want to track this specific instance...

I can't run more than 100 processes

I have a massive number of shell commands being executed with root/admin priveleges through Authorization Services' "AuthorizationExecuteWithPrivileges" call. The issue is that after a while (10-15 seconds, maybe 100 shell commands) the program stops responding with this error in the debugger: couldn't fork: errno 35 And then while the...

Problem using OpenProcess and ReadProcessMemory

I'm having some problems implementing an algorithm to read a foreign process' memory. Here is the main code: System.Diagnostics.Process.EnterDebugMode(); IntPtr retValue = WinApi.OpenProcess((int)WinApi.OpenProcess_Access.VMRead | (int)WinApi.OpenProcess_Access.QueryInformation, 0, (uint)_proc.Id); _p...

How to get the entry point of a child process?

I created a child process from within my process with CreateProcess() (in C++) I then continue on using ReadProcessMemory to read through the memory and search for a specific something. I would like to start my search from the entry point of that process , since the process is loaded into it's own virtual space I have no idea at this po...

Implementing the "system" command in Java.

I have need for a "system" function call, the same as those in Python, Perl, PHP, Ruby, &c. It will be a component of a JavaScript standard library called Narwhal, when it's run on the Rhino JavaScript engine, which is in turn run on Java. The trouble is that Java's standard library appears to have abstracted away the ability to spawn ...

How to capture system stats on the iPhone?

I'm trying to write an iphone app that would mimic the top system utility available on *nix systems. It seems as if system() and/or popen() should enable me to capture output from system commands executed on the iphone. However, the following code gives no output for either popen or system. Is there some other way of getting this info...

How to run processes piped with bash on multiple cores?

I have a simple bash script that pipes output of one process to another. Namely:. dostuff | filterstuff It happens that on my Linux system (openSUSE if it matters, kernel 2.6.27) these both processes run on a single core. However, running different processes on different cores is a default policy that doesn't happen to trigger in th...