Changeset 1423 for trunk/src


Ignore:
Timestamp:
Mar 19, 2008, 7:06:36 PM (17 years ago)
Author:
bird
Message:

Fixed bug in the CreateProcess failure handling, should now fail correctly with exit code 127 if for example a command cannot be found. Fixes #30.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/w32/subproc/sub_proc.c

    r1167 r1423  
    596596                        pproc->last_err = GetLastError();
    597597                        pproc->lerrno = E_FORK;
     598#ifdef KMK
     599                        if (pproc->last_err == ERROR_FILE_NOT_FOUND)
     600                                pproc->exit_code = 127; /* see execve failure in job.c. */
     601#endif
    598602                        fprintf(stderr, "process_begin: CreateProcess(%s, %s, ...) failed.\n",
    599603                                exec_path ? exec_path : "NULL", command_line);
     
    940944                pproc->sv_stderr[0] = 0;
    941945        }
     946
     947#ifdef KMK
     948        if (childhand == NULL || childhand == INVALID_HANDLE_VALUE) {
     949                goto done2;
     950        }
     951#endif
    942952
    943953        /*
     
    13281338    if (!((sub_process*) hProcess)->last_err)
    13291339      ((sub_process*) hProcess)->last_err = -1;
    1330     ((sub_process*) hProcess)->exit_code = process_last_err(hProcess);
     1340#ifdef KMK
     1341    if (!((sub_process*) hProcess)->exit_code)
     1342#endif
     1343      ((sub_process*) hProcess)->exit_code = process_last_err(hProcess);
    13311344
    13321345#ifndef KMK
Note: See TracChangeset for help on using the changeset viewer.