pipe - Detecting death of spawned process using Window CRT -


Executive Summary: I have a need to determine whether I created a Windows project through _spawnl and I'm communicating using FDs from _ PIP has died.

Description:

I am using a low-level CRT function in windows (_eof, _read) which via a call to communicate with a process, _spellel ( P_NOWAIT) with flag I am using _pip to create a file descriptor to communicate with this spanned process and passing those descriptor (FD #) on the command line.

It is worth mentioning that I have a spanded process. This is a black box for me.

It has been found that we are sometimes hunting for accidents. I am trying to strengthen my code by detecting the accident. Unfortunately, I do not have a way to do this Can see To expect this I think it would return an error error status (-1) to say or read one of those descriptors if the process died.

Unfortunately, this is not the case. It appears that the descriptors are independent of the living process, even if the process on the other end has died, I am not getting any error status on the file descriptor, which I am using to communicate with it.

I have received the PID for the nested process _spanwnl call) but I do not see anything that I can do with it, my code works really well except for one thing. It can not be ascertained that the process created is busy in answering or dying.

If I know that the process of production has died then I can use information from _pipe and _spawnl, then I

UPDATE : I A very simple solution has been found and it has been added in this form.

selected answer.

see

You can only use WaitForSingleObject behind the handle from Spangle ; It's working fine for me It seems like you've already tried it, but I'm probably misunderstanding your responses.

The sample code that provokes a process and is waiting for it to end without _P_WAIT:

  handles hpr. = (Handle) _spanal (_P_NOWAIT, " Slave.exe "," slave.exe ", NULL); While (1) {sleep (100); If WaitForSingleObject (H, process) == WAIT_OBJECT_0) {break; }}  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -