GNU bug report logs - #71081
30.0.50; shell-command-on-region outputs boilerplate text on Windows

Previous Next

Package: emacs;

Reported by: Ihor Radchenko <yantar92 <at> posteo.net>

Date: Mon, 20 May 2024 18:34:01 UTC

Severity: normal

Tags: notabug

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #34 received at 71081 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: dmitry <at> gutov.dev, 71081 <at> debbugs.gnu.org, matt <at> excalamus.com
Subject: Re: bug#71081: 30.0.50; shell-command-on-region outputs boilerplate
 text on Windows
Date: Thu, 23 May 2024 16:37:55 +0300
> From: Ihor Radchenko <yantar92 <at> posteo.net>
> Cc: dmitry <at> gutov.dev, 71081 <at> debbugs.gnu.org, matt <at> excalamus.com
> Date: Thu, 23 May 2024 12:06:25 +0000
> 
> Then, what about something like
> 
> (shell-command-to-string "echo foo\necho bar")
> 
> On Linux, it yields
> "foo
> bar"
> 
> On Windows, it yields
> 
> "foo"

Yes, because the Windows shell doesn't support command lines with
embedded newlines, so it ignores everything past the first newline.
(Actually, there are complicated tricks to do that, but I'll spare
you.)

Instead, you should do this on Windows:

  (shell-command-to-string "echo foo && echo bar")

This is the documented method of invoking cmd.exe with multiple
commands.




This bug report was last modified 1 year and 53 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.