PRB: Critical Error During Spawn Will Lose Parent

ID Number: Q43537

5.10 6.00 6.00a 6.00ax

MS-DOS

Summary:

SYMPTOMS

If a critical MS-DOS error occurs when spawning a child program

using one of the spawn functions in Microsoft C 5.1, the child

program may not correctly return to the parent process.

RESOLUTION

A workaround is to attempt to open the .EXE file before the spawn.

The critical error will occur on the open and allow MS-DOS and the

run-time library to handle any problems encountered in a more

elegant fashion.

STATUS

This problem does not occur in Microsoft C version 6.0 and later.

More Information:

The following program can be used to demonstrate the situation:

#include <stdio.h>

#include <process.h>

void main( void )

{

puts("In parent.");

spawnlp( P_WAIT, "a:\\test.exe", "a:\\test.exe", NULL );

puts("Back in parent.");

}

If drive A is ready, TEST.EXE will be spawned correctly and return to

the parent. However, if the drive door is open, the following prompt

will be produced by the MS-DOS critical error handler: "Abort, Retry,

Fail?".

If the drive door is closed and "Retry" is selected, TEST.EXE will run

but not return to the parent, hanging the system.

Additional reference words: 5.10 6.00 6.00a 6.00ax