GNU bug report logs -
#71081
30.0.50; shell-command-on-region outputs boilerplate text on Windows
Previous Next
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
View this message in rfc822 format
Eli Zaretskii <eliz <at> 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>
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.