all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Dmitry Gutov <dmitry@gutov.dev>,
	71081@debbugs.gnu.org, matt@excalamus.com
Subject: bug#71081: 30.0.50; shell-command-on-region outputs boilerplate text on Windows
Date: Wed, 22 May 2024 11:45:23 +0000	[thread overview]
Message-ID: <87le42jcj0.fsf@localhost> (raw)
In-Reply-To: <8634qa8tp0.fsf@gnu.org>

Eli Zaretskii <eliz@gnu.org> writes:
>> On 20/05/2024 21:59, Eli Zaretskii wrote:
>> > If it expects the same behavior from cmd.exe as a Posix
>> > shell would produce, the expectation is simply incorrect and
>> > unjustified.
>> 
>> Perhaps we should run something different, or with different arguments, 
>> when on Windows?
>
> Maybe.  But as I said, I don't have a clear understanding of the
> issue.  If I did, perhaps I could give some advice or even suggest a
> code change if required.

The goal is to evaluate a shell script - multi-line string.

For example, given

"cd foo
pwd"

we need to get the output/value separated from the stderr and stderr
output.

Org mode uses the approach borrowed from `shell-command-on-region' -
passing the script as input to shell process (we use
`process-file'). However, as demonstrated by my reproducer, this
approach generates more than just script output.

In theory, we might pass the script as -c '<shell-escaped script body>',
but that's not all the story. We also sometimes want to pass the script
in chunks (via comint interaction).

When using comint, piping commands to shell process input is the only
way to keep the shell running as we send it more commands. However, the
same problem persists - when sending the very first command, cmd.exe
generates its version data, which we cannot easily distinguish from the
rest of the output. We cannot easily see stderr either.

P.S. CCing Matt, ob-shell maintainer.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>





  reply	other threads:[~2024-05-22 11:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-20 18:34 bug#71081: 30.0.50; shell-command-on-region outputs boilerplate text on Windows Ihor Radchenko
2024-05-20 18:59 ` Eli Zaretskii
2024-05-21 20:18   ` Dmitry Gutov
2024-05-22  2:30     ` Eli Zaretskii
2024-05-22 11:45       ` Ihor Radchenko [this message]
2024-05-22 13:33         ` Eli Zaretskii
2024-05-22 14:26           ` Ihor Radchenko
2024-05-22 14:53             ` Eli Zaretskii
2024-05-23 12:06               ` Ihor Radchenko
2024-05-23 13:37                 ` Eli Zaretskii
2024-05-23 14:00                   ` Ihor Radchenko
2024-05-23 14:14                     ` Eli Zaretskii
2024-05-23 14:36                       ` Ihor Radchenko
2024-05-25 10:03                         ` Eli Zaretskii
2024-05-25 10:03                         ` Eli Zaretskii

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

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

  git send-email \
    --in-reply-to=87le42jcj0.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=71081@debbugs.gnu.org \
    --cc=dmitry@gutov.dev \
    --cc=eliz@gnu.org \
    --cc=matt@excalamus.com \
    /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.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.