[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to run shell command with stream input, to get string output
From: |
Noam Postavsky |
Subject: |
Re: How to run shell command with stream input, to get string output |
Date: |
Mon, 1 Jul 2019 07:12:22 -0400 |
On Mon, 1 Jul 2019 at 05:45, Jean Louis <bugs@gnu.support> wrote:
> Something like that, but it does not work as
> output of process is not written in the buffer.
When input is not newline terminated, cat requires two EOFs. I find
this is the case when running outside of Emacs as well.
(with-temp-buffer
(let* ((process (start-process "NEW" (current-buffer) "cat")))
;; Don't include "Process NEW finished\n".
(set-process-sentinel process #'ignore)
(process-send-string process "Hello")
(process-send-eof process)
(process-send-eof process)
(while (accept-process-output process))
(buffer-string)))
But if you don't need asynchoronous input, call-process-region is simpler:
(with-temp-buffer
(insert "Hello")
(call-process-region (point-min) (point-max)
"tr" t '(t t) nil "a-z" "A-Z")
(buffer-string))
- Re: How to run shell command with stream input, to get string output, Marcin Borkowski, 2019/07/01
- Re: How to run shell command with stream input, to get string output, Jean Louis, 2019/07/01
- Re: How to run shell command with stream input, to get string output, tomas, 2019/07/01
- Re: How to run shell command with stream input, to get string output, Jean Louis, 2019/07/01
- Re: How to run shell command with stream input, to get string output, Robert Pluim, 2019/07/01
- Re: How to run shell command with stream input, to get string output, Jean Louis, 2019/07/01
- Re: How to run shell command with stream input, to get string output,
Noam Postavsky <=
- Re: How to run shell command with stream input, to get string output, Jean Louis, 2019/07/01
Re: How to run shell command with stream input, to get string output, Marcin Borkowski, 2019/07/01
- Re: How to run shell command with stream input, to get string output, Jean Louis, 2019/07/01
- Re: How to run shell command with stream input, to get string output, Marcin Borkowski, 2019/07/04
- Re: How to run shell command with stream input, to get string output, Jean Louis, 2019/07/04
- Re: How to run shell command with stream input, to get string output, Jean Louis, 2019/07/04