473,387 Members | 1,771 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Process Fails while calling Start

Hi all,

I'm creating processes of a console based application. After
proc.Start() the process is not getting terminated and the thread
keeps waiting for some reponse from the process. Now I need to kill
the process if it takes more time.

Process proc = new Process();

proc.StartInfo.FileName = "application";
proc.StartInfo.WorkingDirectory = workingdir;
proc.StartInfo.Arguments = " args1 arg2";
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
logger.Debug("Parameters used : " + proc.StartInfo.Arguments);
proc.Start();
proc.WaitForExit();
proc.Dispose();

The process is started when the control reaches proc.Start(). Hope the
control should move to the next statement proc.WaitForExit() and wait
until the process gets completed. The control is not moving out of the
statement.

When I look at the threads from .NET IDE, I could see a thread still
active for this call. No further execution is allowed from this point.
Any clue why this is failing?

How can I do this? Otherwise I need to terminate those threads if
running for more time.

Thanks

Jan 31 '07 #1
2 3208
On Jan 31, 10:54 am, "Anbu" <Anbu.Thangarathi...@gmail.comwrote:
Hi all,

I'm creating processes of a console based application. After
proc.Start() the process is not getting terminated and the thread
keeps waiting for some reponse from the process. Now I need to kill
the process if it takes more time.

Process proc = new Process();

proc.StartInfo.FileName = "application";
proc.StartInfo.WorkingDirectory = workingdir;
proc.StartInfo.Arguments = " args1 arg2";
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
logger.Debug("Parameters used : " + proc.StartInfo.Arguments);
proc.Start();
proc.WaitForExit();
proc.Dispose();

The process is started when the control reaches proc.Start(). Hope the
control should move to the next statement proc.WaitForExit() and wait
until the process gets completed. The control is not moving out of the
statement.

When I look at the threads from .NET IDE, I could see a thread still
active for this call. No further execution is allowed from this point.
Any clue why this is failing?

How can I do this? Otherwise I need to terminate those threads if
running for more time.

Thanks
I'm not very sure about your situation, but perhaps you can try
multithreading. Create another thread that remains in control even
though this thread this waiting. When this thread launches the
process, the other thread is notified and should wait for some time,
if it takes too long, it terminates the process.

Jan 31 '07 #2
"Anbu" <An*****************@gmail.comwrote in message
news:11**********************@v45g2000cwv.googlegr oups.com...
Hi all,

I'm creating processes of a console based application. After
proc.Start() the process is not getting terminated and the thread
keeps waiting for some reponse from the process. Now I need to kill
the process if it takes more time.

Process proc = new Process();

proc.StartInfo.FileName = "application";
proc.StartInfo.WorkingDirectory = workingdir;
proc.StartInfo.Arguments = " args1 arg2";
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
logger.Debug("Parameters used : " + proc.StartInfo.Arguments);
proc.Start();
proc.WaitForExit();
proc.Dispose();

The process is started when the control reaches proc.Start(). Hope the
control should move to the next statement proc.WaitForExit() and wait
until the process gets completed. The control is not moving out of the
statement.

When I look at the threads from .NET IDE, I could see a thread still
active for this call. No further execution is allowed from this point.
Any clue why this is failing?

How can I do this? Otherwise I need to terminate those threads if
running for more time.

Thanks


Why starting a new thread while this same question has been answered in another thread of
yours?

Willy.

Jan 31 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: serge calderara | last post by:
Dear all, I have an application which is suppose to start another executable process. As soon as that process is running, I need to retrive its handle. The problem of the particular process I am...
10
by: Sorin Dolha [MCSD .NET] | last post by:
I would like to start a process from C# code as another user. The C# code is executed as the ASPNET user because it relies in a Web Page class, and I would like that the process will run as another...
1
by: Bucky Pollard | last post by:
I have a web service that needs to create a batch file and call it (since there are no APIs for the functionality I am looking for). I am using the Process and ProcessStartInfo objects. When I try...
2
by: Terry Olsen | last post by:
Using the following code, I get the error "No process is associated with this object" when calling the WinZip.WaitForExit() method. After I click the "Break" or "Continue" button on the dialog,...
8
by: Shachar | last post by:
Hi All, I need to start a new process calc for example and when ever the user click on the button the application should setfocus to the calc application. I use this code but it is NOT...
0
by: Daniel | last post by:
System.Diagnostics.Process.Start fails on windows server 2003 the process returns process.ExitCode == 0 but executing any process with System.Diagnostics.Process.Start on windows xp works fine....
6
by: bill | last post by:
I have a VB .net 2.0 site that needs to run a dos app upon a button click. I found Shell too unreliable using parameters and so used system.diagnostic.process. simple troubleshooting...
10
by: Stephany Young | last post by:
When one uses the System.Diagnostics.Process.Start method to launch a common or garden Console application, one can set the WindowStyle property of the StartInfo object to ProcessWindowStyle.Hidden...
0
by: =?Utf-8?B?SmFzb24gTGluZA==?= | last post by:
Hi, I have a WCF Service hosted by a Windows Service using Impersonation. The impersonation seems to be configured correctly, in that Thread.CurrentPrinipal is the user calling the service, not the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.