process

Set the working path correctly

ProcessBuilder pb = new ProcessBuilder("pwd"); pb.directory(new File("/server1/work/uz/rt/adapt/0/")); Process s = pb.start(); I expected the output to be /server1/work/uz/rt/adapt/0/, but instead it's: /work/uz/rt/adapt/0/ /work/uz/rt/adapt/0/ and /server1/work/uz/rt/adapt/0/ are equivalent (mounted at the same place,/work/.. is co...

prevent a c# application from running more than one instance

Hello, I wrote a program in c# now I would like to know what is the proper way to prevent the program from starting if it is already running? so if it is already running, and double-click on the program it will not start because it is already running. I can do that, but I was thinking of a standard and proper way cheers ...

Process Queue Timer

I want to scan a queue every 10 seconds using a Timer. If there are more then 0 items in this queue then Deque the first one, pass it as an argument to a Process and run that process. The timer should be disabled while this process executes. Once the process exits, it should re-enable the timer. The items in the queue can be added manua...

java is not executing system command

In the following program am giving name as "don" so the command will search activedirectory with all the names starting with don (like donald etc). But the line2 variable becomes null after the assignment from reader object and it never goes into the loop. What am i doing wrong? FYI: the command works when i give it on the command line. ...

Python: Changing process name with setproctitle

Hi I have a python script which launches a number of C++ programs, each program is passed a command line parameter as shown below process_path "~/test/" process_name "test" num_process = 10 for p in range(1, num_processes, 1): subprocess.Popen([process_path + process_name, str(p)], shell = False) Is it possible to us setproctit...

Vista/7 compile and XP/2000 execution issues with OpenProcess in C++

I've been using OpenProcess with PROCESS_ALL_ACCESS rights for the following functions: -EnumProcessModules -GetModuleFileNameEx -ReadProcessMemory -WriteProcessMemory which works fine on Windows Vista/7. However, in Windows XP/2000, it won't open the process with PROCESS_ALL_ACCESS because according to the MSDN library: The size of t...

python + windows: run exe as if it's unrelated to the current process

I know I can use subprocess.Popen to run an executable, and potentially redirect stdin and stdout to files / using pipes to my process. Is there a way to run an executable such that the spawned process has no relation to the current Python process, however? Meaning, I want to start a process in the same way as if I would double-click on ...

Communicating with a command line tool in Java

Hi, I want to use a linux command line tool from my Java program. I start the program and get the output using the Process class (http://download.oracle.com/javase/6/docs/api/java/lang/Process.html): /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { Process proc = Runtime....

Waiting child processes

I try fork child processes and wait them to die.I first fork N child processes and then wait in a loop. But it seems it doesn't wait the child processes to die.It exits the loop altough the childs do not die. Here's my code: void DistributorSubsystem::Start() { Application::instance().logger().information("Distributor Subsytem s...

Timeout by attaching a process in visual studio

Hello everyone, I am creating a webpage in Visual Studio 2005, and I attach that project to a process like Firefox or whatever. If I create a breakpoint in the code (for example to a click event), and I am too much time looking at the code, suddenly the process unattach and I cannot continue looking the code. Question: Does anyone know...

How to detect win32 process creation/termination in c++

Hi, I know that to receive notifications about win32 process creation or termination we might implement a NT kernel-mode driver using the APIs PsSetCreateProcessNotifyRoutine() that offers the ability to register system-wide callback function which is called by OS each time when a new process starts, exits or is terminated. My question...

Using getrusage

Hello Everyone! As a continuation of this question I'm wondering if I can get some simple sample code as to how to make use of getrusage. I would like to use it to find the time CPU used by a process, ideally from the PID. I'm working in Cocoa, Objective_C and of course C. Any help would be awesome! Thanks ...

Why Erlang process creation and message passing time less than java and C#

I was searching about process model of Erlang over internet and found out some graphs slides 3-4 in one of the talk given by Joe Armstrong. They shows a lot of difference between process creation and message passing time between Erlang , java and C#. Can anybody tell me the reason behind such big difference? ...

Force process close on error

Hi, I'm writing a program that is able to throw up errors due using LuaInterface and loading in editable scripts, this causes a problem as on error no "Application.Exit" or "Form.FormClosing" events seem to be called. I therefore cannot guarantee the shutdown of a process I run within the application. Is there any way of closing the lau...

what should I do to get the new process using a new command prompt window ?

I got two console applications that the first one runs the second one: 1_first console application: #include <Tchar.h> #include <windows.h> #include <iostream> using namespace std; void main(){ PROCESS_INFORMATION obj1; memset(&obj1,0,sizeof(PROCESS_INFORMATION)); STARTUPINFOW obj2; memset(&obj2,0,sizeof(STARTUPINFOW)); obj2.cb...

Help running Java runtime.exec() on multiple threads

Hello, In my program, I need to run a external command in a Ubuntu environment (ntpdate) using java. Currently my code looks like this: Runtime rt = Runtime.getRuntime(); byte[] readBuffer = new byte[131072]; // Exec a process to do the query Process p = null; try { p = rt.exec("ntpdate -q " + ip); } ca...

Android Services and Activities.

Hi, I have some questions about the Android service and activity lifecycles. Hope you guys can help me out. I have written an application that uses GPS location and stores them. It must monitor the GPS location updates constantly to work properly. Right now, it's all in one activity. So when you close the activity, you loose everything...

how to allow a process created by another process, use a part of memory of the creator process ?

I got two console processes that second one is created by first one using the API below: BOOL WINAPI CreateProcess( __in_opt LPCTSTR lpApplicationName, __inout_opt LPTSTR lpCommandLine, __in_opt LPSECURITY_ATTRIBUTES lpProcessAttributes, __in_opt LPSECURITY_ATTRIBUTES lpThreadAttributes, __in BOOL bInherit...

How to determine whether a System.Diagnostics.Process is 32 or 64 bit?

I tried: process.MainModule.FileName.Contains("x86") But it threw an exception for a x64 process: Win32Exception: Only a part of the ReadProcessMemory ou WriteProcessMemory request finished ...

What's the best way to start a background process, that can get accessed later on

Hi, I am currently developing a RubyGem that provides an executable. The executable keeps track of the state of some log files using the FSSM gem. This executable should get started, do something in background, and get stopped later on. For example: $ my_executable start # do something different... $ my_executable stop I would firs...