By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,989 Members | 1,457 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,989 IT Pros & Developers. It's quick & easy.

Process Fails while calling Start

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
"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 discussion thread is closed

Replies have been disabled for this discussion.