diff options
| author | Stefan Monnier | 2008-05-29 16:54:53 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2008-05-29 16:54:53 +0000 |
| commit | 891bd142e24cc64eabde86d038c80dab66e37d36 (patch) | |
| tree | 92a276922220a86fbb77de0949f9192782e6b3de /src/process.c | |
| parent | c2d0b538ee5f5ce37f27c0609e285eea581216af (diff) | |
| download | emacs-891bd142e24cc64eabde86d038c80dab66e37d36.tar.gz emacs-891bd142e24cc64eabde86d038c80dab66e37d36.zip | |
(Faccept_process_output): If `millisec' is non-nil, `seconds' default to 0.
(wait_reading_process_output): Also return non-nil if we read output
from a non-running process.
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/process.c b/src/process.c index e1735750806..413bd8522b3 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -3896,6 +3896,7 @@ Non-nil second arg SECONDS and third arg MILLISEC are number of | |||
| 3896 | seconds and milliseconds to wait; return after that much time whether | 3896 | seconds and milliseconds to wait; return after that much time whether |
| 3897 | or not there is input. If SECONDS is a floating point number, | 3897 | or not there is input. If SECONDS is a floating point number, |
| 3898 | it specifies a fractional number of seconds to wait. | 3898 | it specifies a fractional number of seconds to wait. |
| 3899 | The MILLISEC argument is obsolete and should be avoided. | ||
| 3899 | 3900 | ||
| 3900 | If optional fourth arg JUST-THIS-ONE is non-nil, only accept output | 3901 | If optional fourth arg JUST-THIS-ONE is non-nil, only accept output |
| 3901 | from PROCESS, suspending reading output from other processes. | 3902 | from PROCESS, suspending reading output from other processes. |
| @@ -3911,6 +3912,18 @@ Return non-nil if we received any output before the timeout expired. */) | |||
| 3911 | else | 3912 | else |
| 3912 | just_this_one = Qnil; | 3913 | just_this_one = Qnil; |
| 3913 | 3914 | ||
| 3915 | if (!NILP (millisec)) | ||
| 3916 | { /* Obsolete calling convention using integers rather than floats. */ | ||
| 3917 | CHECK_NUMBER (millisec); | ||
| 3918 | if (NILP (seconds)) | ||
| 3919 | seconds = make_float (XINT (millisec) / 1000.0); | ||
| 3920 | else | ||
| 3921 | { | ||
| 3922 | CHECK_NUMBER (seconds); | ||
| 3923 | seconds = make_float (XINT (millisec) / 1000.0 + XINT (seconds)); | ||
| 3924 | } | ||
| 3925 | } | ||
| 3926 | |||
| 3914 | if (!NILP (seconds)) | 3927 | if (!NILP (seconds)) |
| 3915 | { | 3928 | { |
| 3916 | if (INTEGERP (seconds)) | 3929 | if (INTEGERP (seconds)) |
| @@ -3924,19 +3937,6 @@ Return non-nil if we received any output before the timeout expired. */) | |||
| 3924 | else | 3937 | else |
| 3925 | wrong_type_argument (Qnumberp, seconds); | 3938 | wrong_type_argument (Qnumberp, seconds); |
| 3926 | 3939 | ||
| 3927 | if (INTEGERP (millisec)) | ||
| 3928 | { | ||
| 3929 | int carry; | ||
| 3930 | usecs += XINT (millisec) * 1000; | ||
| 3931 | carry = usecs / 1000000; | ||
| 3932 | secs += carry; | ||
| 3933 | if ((usecs -= carry * 1000000) < 0) | ||
| 3934 | { | ||
| 3935 | secs--; | ||
| 3936 | usecs += 1000000; | ||
| 3937 | } | ||
| 3938 | } | ||
| 3939 | |||
| 3940 | if (secs < 0 || (secs == 0 && usecs == 0)) | 3940 | if (secs < 0 || (secs == 0 && usecs == 0)) |
| 3941 | secs = -1, usecs = 0; | 3941 | secs = -1, usecs = 0; |
| 3942 | } | 3942 | } |
| @@ -4475,7 +4475,10 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, | |||
| 4475 | break; | 4475 | break; |
| 4476 | 4476 | ||
| 4477 | if (0 < nread) | 4477 | if (0 < nread) |
| 4478 | total_nread += nread; | 4478 | { |
| 4479 | total_nread += nread; | ||
| 4480 | got_some_input = 1; | ||
| 4481 | } | ||
| 4479 | #ifdef EIO | 4482 | #ifdef EIO |
| 4480 | else if (nread == -1 && EIO == errno) | 4483 | else if (nread == -1 && EIO == errno) |
| 4481 | break; | 4484 | break; |