unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Redirecting standard output
@ 2011-04-20 21:19 Lars Magne Ingebrigtsen
  2011-04-20 22:54 ` Stefan Monnier
  2011-04-21  5:57 ` Eli Zaretskii
  0 siblings, 2 replies; 37+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-04-20 21:19 UTC (permalink / raw)
  To: emacs-devel

I was trying to play around with the pbmplus programs from Emacs, and
that turns out to be somewhat awkward.  The programs all send output to
STDOUT, and there seems to be no way to easily redirect STDOUT with
`call-process'.

You can usually work around this by using `shell-command' or the like,
but when dealing with directories that contain arbitrary characters,
getting the quoting right can be somewhat icky.  (Although I found
`shell-quote-argument' just now while writing this.  :-)

Anyway, `call-process' allows redirecting STDERR to a file, but
apparently not STDOUT:

----
Insert output in BUFFER before point; t means current buffer;
 nil for BUFFER means discard it; 0 means discard and don't wait.
BUFFER can also have the form (REAL-BUFFER STDERR-FILE); in that case,
REAL-BUFFER says what to do with standard output, as above,
while STDERR-FILE says what to do with standard error in the child.
STDERR-FILE may be nil (discard standard error output),
t (mix it with ordinary output), or a file name string.
----

(On the other side, you can't redirect STDERR to a buffer, it seems?)

Unless I've missed something here, would anybody object to me extending
`call-process' to allow redirecting STDOUT to a file, too?

I'm not sure what the syntax would be, though, since a string parameter
to REAL-BUFFER already means "use the buffer with this name"....
eurmh...  well, off the top of my head, we could use keywords for the
complex case.  That is BUFFER could be, er, something like

(:stdout (:file "/tmp/foo") :stderr (:buffer "bar"))

Backwards compatibility would be easy to maintain.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2011-05-30 17:39 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-20 21:19 Redirecting standard output Lars Magne Ingebrigtsen
2011-04-20 22:54 ` Stefan Monnier
2011-04-21  1:54   ` Lars Magne Ingebrigtsen
2011-04-21  6:10     ` Eli Zaretskii
2011-04-21 11:45       ` Lars Magne Ingebrigtsen
2011-04-21 13:25         ` Lars Magne Ingebrigtsen
2011-04-21 14:10           ` Eli Zaretskii
2011-04-21 15:15             ` Lars Magne Ingebrigtsen
2011-04-21 15:46               ` Lars Magne Ingebrigtsen
2011-04-21 16:15                 ` Eli Zaretskii
2011-04-21 16:22                   ` Lars Magne Ingebrigtsen
2011-04-21 16:24                   ` Lars Magne Ingebrigtsen
2011-04-21 16:55                     ` Eli Zaretskii
2011-04-21 17:05             ` Jan Djärv
2011-04-21 19:15               ` Eli Zaretskii
2011-04-21 19:19                 ` Davis Herring
2011-04-21 19:31                   ` Lars Magne Ingebrigtsen
2011-04-22  5:50                     ` Eli Zaretskii
2011-04-23 18:46                       ` Lars Magne Ingebrigtsen
2011-04-23 20:10                         ` Eli Zaretskii
2011-04-24  8:30                           ` Jan Djärv
2011-04-30 23:58                             ` Lars Magne Ingebrigtsen
2011-05-01  0:06                               ` Lars Magne Ingebrigtsen
2011-05-01 17:56                                 ` Andy Moreton
2011-05-07 11:34                                 ` Eli Zaretskii
2011-05-07 12:10                                   ` Eli Zaretskii
2011-05-30 17:39                                     ` Lars Magne Ingebrigtsen
2011-04-21 16:29           ` Glenn Morris
2011-04-21  8:27   ` Michael Albinus
2011-04-21  5:57 ` Eli Zaretskii
2011-04-21  6:28   ` Thierry Volpiatto
2011-04-21  6:41     ` Eli Zaretskii
2011-04-21  7:33       ` Thierry Volpiatto
2011-04-21 11:40   ` Lars Magne Ingebrigtsen
2011-04-21 11:58     ` Eli Zaretskii
2011-04-21 12:24       ` Lars Magne Ingebrigtsen
2011-04-21 14:25         ` Lars Magne Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).