From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Eli Zaretskii <eliz@gnu.org>
Newsgroups: gmane.emacs.bugs
Subject: bug#71081: 30.0.50;
 shell-command-on-region outputs boilerplate text on Windows
Date: Thu, 23 May 2024 16:37:55 +0300
Message-ID: <86bk4w4pjg.fsf@gnu.org>
References: <875xv8qqlv.fsf@localhost> <86y1848g3a.fsf@gnu.org>
 <863fc61b-5ad5-47e5-9f95-96cdcfcfd016@gutov.dev> <8634qa8tp0.fsf@gnu.org>
 <87le42jcj0.fsf@localhost> <86a5ki6kf1.fsf@gnu.org>
 <875xv5kjmg.fsf@localhost> <86zfsh6gpp.fsf@gnu.org> <87cypcybpa.fsf@localhost>
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="19192"; mail-complaints-to="usenet@ciao.gmane.io"
Cc: dmitry@gutov.dev, 71081@debbugs.gnu.org, matt@excalamus.com
To: Ihor Radchenko <yantar92@posteo.net>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 23 15:39:19 2024
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>
Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org
Original-Received: from lists.gnu.org ([209.51.188.17])
	by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
	(Exim 4.92)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1sA8f8-0004lB-2d
	for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 23 May 2024 15:39:18 +0200
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <bug-gnu-emacs-bounces@gnu.org>)
	id 1sA8er-0001wz-Dp; Thu, 23 May 2024 09:39:02 -0400
Original-Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1sA8em-0001v0-C1
 for bug-gnu-emacs@gnu.org; Thu, 23 May 2024 09:38:56 -0400
Original-Received: from debbugs.gnu.org ([2001:470:142:5::43])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1sA8el-00041u-BD
 for bug-gnu-emacs@gnu.org; Thu, 23 May 2024 09:38:55 -0400
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1sA8er-0002uf-Ly
 for bug-gnu-emacs@gnu.org; Thu, 23 May 2024 09:39:01 -0400
X-Loop: help-debbugs@gnu.org
Resent-From: Eli Zaretskii <eliz@gnu.org>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Thu, 23 May 2024 13:39:01 +0000
Resent-Message-ID: <handler.71081.B71081.171647149511189@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 71081
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: notabug
Original-Received: via spool by 71081-submit@debbugs.gnu.org id=B71081.171647149511189
 (code B ref 71081); Thu, 23 May 2024 13:39:01 +0000
Original-Received: (at 71081) by debbugs.gnu.org; 23 May 2024 13:38:15 +0000
Original-Received: from localhost ([127.0.0.1]:59097 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1sA8e6-0002uP-SN
 for submit@debbugs.gnu.org; Thu, 23 May 2024 09:38:15 -0400
Original-Received: from eggs.gnu.org ([209.51.188.92]:48712)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@gnu.org>) id 1sA8e4-0002uJ-Oe
 for 71081@debbugs.gnu.org; Thu, 23 May 2024 09:38:13 -0400
Original-Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@gnu.org>)
 id 1sA8ds-0003xy-8R; Thu, 23 May 2024 09:38:00 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=RepLtd29DW9ndTngEXn1hywjrP8bFO8N60ezb2f39YA=; b=WNtBh6IngkcZ
 /jzaJBzq/x4BD8cwyKvPk2YYBKGvQiJBobTwys50WI0QDg7Ml+e1qImBEH/kDVCBhN+ofL8MCk3QD
 1GVdWE4jdDkiVjXW1LWQ9CBE/0UnbrGGvLV+SvdEfVjsyjUhvlJ2QbVMWhCaVwOQq3R4mQYPsi01p
 rRPjeQYtY0NYb4PSljeWq5A+lxXiOcCHJeUnjVjhgU4kRxmJQlPlX8Ld08vVSOAHT1HIuKpO4RPQ4
 brobeBYcrytiYvrs51QPrv7IfQhDZlWGeM7vbv+D4HHCjEqh9MTfBEfKaf4NGb49n/4TIet/LilRD
 y6lC6tF+fmqecphcFgjNYg==;
In-Reply-To: <87cypcybpa.fsf@localhost> (message from Ihor Radchenko on Thu,
 23 May 2024 12:06:25 +0000)
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-BeenThere: bug-gnu-emacs@gnu.org
List-Id: "Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/bug-gnu-emacs>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Xref: news.gmane.io gmane.emacs.bugs:285708
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/285708>

> From: Ihor Radchenko <yantar92@posteo.net>
> Cc: dmitry@gutov.dev, 71081@debbugs.gnu.org, matt@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.