[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Confused about sending text to a subprocess
From: |
Sean McAfee |
Subject: |
Re: Confused about sending text to a subprocess |
Date: |
Tue, 04 May 2010 15:43:59 -0000 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.3 (darwin) |
Harald Hanche-Olsen <hanche@math.ntnu.no> writes:
> + Sean McAfee <eefacm@gmail.com>:
>> So I have this little Perl script:
>> [...]
>> I invoke it from Emacs like this:
>>
>> (let ((proc (start-process "x" nil "/path/to/perl/script")))
>> (process-send-string proc "foo\n")
>> (process-send-eof proc))
>>
>> It works as I expect. But if I leave off that newline:
>>
>> (process-send-string proc "foo")
>>
>> ...then the subprocess does not exit.
>
> That is because emacs runs it in a pty, and "eof" on a pty in line
> buffered mode is signaled to the reading process by read() returning 0
> bytes.
Ah, OK, that makes sense. I was expecting an ordinary pipe. And a
little more digging in the manual turned up the variable
process-connection-type, which if nil will cause the processes started
by start-process to be connected with an ordinary pipe.
Thanks for the tip!