diff options
| author | Richard M. Stallman | 1996-12-08 21:36:42 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-12-08 21:36:42 +0000 |
| commit | 4da2f5be4ace0fee2bf033019fe3c9a8b966a866 (patch) | |
| tree | cba387b0f576fe0077f4da312f4842693224b57e /src | |
| parent | e1ddc4b48db77e051615aefbd153af54a472076c (diff) | |
| download | emacs-4da2f5be4ace0fee2bf033019fe3c9a8b966a866.tar.gz emacs-4da2f5be4ace0fee2bf033019fe3c9a8b966a866.zip | |
(status_notify): Test p->infd > 0
before each call to read_process_output.
(read_process_output): Handle match data properly in recursive calls.
(exec_sentinel): Likewise.
Diffstat (limited to 'src')
| -rw-r--r-- | src/process.c | 48 |
1 files changed, 43 insertions, 5 deletions
diff --git a/src/process.c b/src/process.c index 296f8606ea4..e902cc7b519 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -2512,6 +2512,7 @@ read_process_output (proc, channel) | |||
| 2512 | int count = specpdl_ptr - specpdl; | 2512 | int count = specpdl_ptr - specpdl; |
| 2513 | Lisp_Object odeactivate; | 2513 | Lisp_Object odeactivate; |
| 2514 | Lisp_Object obuffer, okeymap; | 2514 | Lisp_Object obuffer, okeymap; |
| 2515 | int outer_running_asynch_code = running_asynch_code; | ||
| 2515 | 2516 | ||
| 2516 | /* No need to gcpro these, because all we do with them later | 2517 | /* No need to gcpro these, because all we do with them later |
| 2517 | is test them for EQness, and none of them should be a string. */ | 2518 | is test them for EQness, and none of them should be a string. */ |
| @@ -2522,7 +2523,24 @@ read_process_output (proc, channel) | |||
| 2522 | specbind (Qinhibit_quit, Qt); | 2523 | specbind (Qinhibit_quit, Qt); |
| 2523 | specbind (Qlast_nonmenu_event, Qt); | 2524 | specbind (Qlast_nonmenu_event, Qt); |
| 2524 | 2525 | ||
| 2526 | /* In case we get recursively called, | ||
| 2527 | and we already saved the match data nonrecursively, | ||
| 2528 | save the same match data in safely recursive fashion. */ | ||
| 2529 | if (outer_running_asynch_code) | ||
| 2530 | { | ||
| 2531 | Lisp_Object tem; | ||
| 2532 | /* Don't clobber the CURRENT match data, either! */ | ||
| 2533 | tem = Fmatch_data (); | ||
| 2534 | restore_match_data (); | ||
| 2535 | record_unwind_protect (Fstore_match_data, Fmatch_data ()); | ||
| 2536 | Fstore_match_data (tem); | ||
| 2537 | } | ||
| 2538 | |||
| 2539 | /* For speed, if a search happens within this code, | ||
| 2540 | save the match data in a special nonrecursive fashion. */ | ||
| 2525 | running_asynch_code = 1; | 2541 | running_asynch_code = 1; |
| 2542 | |||
| 2543 | /* Read and dispose of the process output. */ | ||
| 2526 | internal_condition_case_1 (read_process_output_call, | 2544 | internal_condition_case_1 (read_process_output_call, |
| 2527 | Fcons (outstream, | 2545 | Fcons (outstream, |
| 2528 | Fcons (proc, | 2546 | Fcons (proc, |
| @@ -2531,8 +2549,10 @@ read_process_output (proc, channel) | |||
| 2531 | Qnil))), | 2549 | Qnil))), |
| 2532 | !NILP (Vdebug_on_error) ? Qnil : Qerror, | 2550 | !NILP (Vdebug_on_error) ? Qnil : Qerror, |
| 2533 | read_process_output_error_handler); | 2551 | read_process_output_error_handler); |
| 2534 | running_asynch_code = 0; | 2552 | |
| 2553 | /* If we saved the match data nonrecursively, restore it now. */ | ||
| 2535 | restore_match_data (); | 2554 | restore_match_data (); |
| 2555 | running_asynch_code = outer_running_asynch_code; | ||
| 2536 | 2556 | ||
| 2537 | /* Handling the process output should not deactivate the mark. */ | 2557 | /* Handling the process output should not deactivate the mark. */ |
| 2538 | Vdeactivate_mark = odeactivate; | 2558 | Vdeactivate_mark = odeactivate; |
| @@ -3512,6 +3532,7 @@ exec_sentinel (proc, reason) | |||
| 3512 | Lisp_Object sentinel, obuffer, odeactivate, okeymap; | 3532 | Lisp_Object sentinel, obuffer, odeactivate, okeymap; |
| 3513 | register struct Lisp_Process *p = XPROCESS (proc); | 3533 | register struct Lisp_Process *p = XPROCESS (proc); |
| 3514 | int count = specpdl_ptr - specpdl; | 3534 | int count = specpdl_ptr - specpdl; |
| 3535 | int outer_running_asynch_code = running_asynch_code; | ||
| 3515 | 3536 | ||
| 3516 | /* No need to gcpro these, because all we do with them later | 3537 | /* No need to gcpro these, because all we do with them later |
| 3517 | is test them for EQness, and none of them should be a string. */ | 3538 | is test them for EQness, and none of them should be a string. */ |
| @@ -3531,14 +3552,31 @@ exec_sentinel (proc, reason) | |||
| 3531 | specbind (Qinhibit_quit, Qt); | 3552 | specbind (Qinhibit_quit, Qt); |
| 3532 | specbind (Qlast_nonmenu_event, Qt); | 3553 | specbind (Qlast_nonmenu_event, Qt); |
| 3533 | 3554 | ||
| 3555 | /* In case we get recursively called, | ||
| 3556 | and we already saved the match data nonrecursively, | ||
| 3557 | save the same match data in safely recursive fashion. */ | ||
| 3558 | if (outer_running_asynch_code) | ||
| 3559 | { | ||
| 3560 | Lisp_Object tem; | ||
| 3561 | tem = Fmatch_data (); | ||
| 3562 | restore_match_data (); | ||
| 3563 | record_unwind_protect (Fstore_match_data, Fmatch_data ()); | ||
| 3564 | Fstore_match_data (tem); | ||
| 3565 | } | ||
| 3566 | |||
| 3567 | /* For speed, if a search happens within this code, | ||
| 3568 | save the match data in a special nonrecursive fashion. */ | ||
| 3534 | running_asynch_code = 1; | 3569 | running_asynch_code = 1; |
| 3570 | |||
| 3535 | internal_condition_case_1 (read_process_output_call, | 3571 | internal_condition_case_1 (read_process_output_call, |
| 3536 | Fcons (sentinel, | 3572 | Fcons (sentinel, |
| 3537 | Fcons (proc, Fcons (reason, Qnil))), | 3573 | Fcons (proc, Fcons (reason, Qnil))), |
| 3538 | !NILP (Vdebug_on_error) ? Qnil : Qerror, | 3574 | !NILP (Vdebug_on_error) ? Qnil : Qerror, |
| 3539 | exec_sentinel_error_handler); | 3575 | exec_sentinel_error_handler); |
| 3540 | running_asynch_code = 0; | 3576 | |
| 3577 | /* If we saved the match data nonrecursively, restore it now. */ | ||
| 3541 | restore_match_data (); | 3578 | restore_match_data (); |
| 3579 | running_asynch_code = outer_running_asynch_code; | ||
| 3542 | 3580 | ||
| 3543 | Vdeactivate_mark = odeactivate; | 3581 | Vdeactivate_mark = odeactivate; |
| 3544 | #if 0 | 3582 | #if 0 |
| @@ -3589,9 +3627,9 @@ status_notify () | |||
| 3589 | XSETINT (p->update_tick, XINT (p->tick)); | 3627 | XSETINT (p->update_tick, XINT (p->tick)); |
| 3590 | 3628 | ||
| 3591 | /* If process is still active, read any output that remains. */ | 3629 | /* If process is still active, read any output that remains. */ |
| 3592 | if (XINT (p->infd) >= 0) | 3630 | while (! EQ (p->filter, Qt) |
| 3593 | while (! EQ (p->filter, Qt) | 3631 | && XINT (p->infd) >= 0 |
| 3594 | && read_process_output (proc, XINT (p->infd)) > 0); | 3632 | && read_process_output (proc, XINT (p->infd)) > 0); |
| 3595 | 3633 | ||
| 3596 | buffer = p->buffer; | 3634 | buffer = p->buffer; |
| 3597 | 3635 | ||