unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Sean McAfee <eefacm@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Confused about sending text to a subprocess
Date: Sat, 03 Apr 2010 01:47:57 -0700	[thread overview]
Message-ID: <m2iq8853cy.fsf@gmail.com> (raw)
In-Reply-To: pcotyrtqlj3.fsf@math.ntnu.no

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!


      reply	other threads:[~2010-04-03  8:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-03  0:29 Confused about sending text to a subprocess Sean McAfee
2010-04-03  3:09 ` Harald Hanche-Olsen
2010-04-03  8:47   ` Sean McAfee [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2iq8853cy.fsf@gmail.com \
    --to=eefacm@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).