[bug #68006] 'system' command unable to redirect stderr or stdout to "nul"
Markus Mützel <[email protected]>
| Newsgroups | gmane.comp.gnu.octave.bugs |
|---|---|
| Message-ID | <[email protected]> |
Please use the bug tracker to post updates to a bug report. The mailing list is intended as a read-only notification stream. Info posted to this mailing list address won't appear in the tracker database where it is most useful.
Update of bug #68006 (group octave):
Status: None => Confirmed
_______________________________________________________
Follow-up Comment #1:
I don't have a standalone Java installation on my computer. I'm trying to
reproduce with `gcc`. So, the behavior might be different.
It works for me with Octave 11.0.90:
octave:1> a = system('gcc -version')
gcc: error: unrecognized command-line option '-version'
gcc: fatal error: no input files
compilation terminated.
a = 1
octave:2> a = system('gcc -version 2> nul')
a = 1
octave:3>
It seems that I can reproduce with hg id da8fedf4ca57 (built natively using
MSYS2/MINGW64):
octave:1> a = system('gcc -version')
gcc: error: unrecognized command-line option '-version'
gcc: fatal error: no input files
compilation terminated.
a = 1
octave:2> a = system('gcc -version 2> nul')
gcc: error: unrecognized command-line option '-version'
a = 1
Interestingly, part of the output does disappear.
If I use the two-output form of `system`, the additional line disappears as
well:
octave:3> [a, b] = system('gcc -version 2> nul')
a = 1
b =
octave:4>
Re-directing stderr to stdout also behaves surprisingly. It works correctly in
the two-output form, but only redirects part of the output in the one output
argument form:
octave:7> [a, b] = system('gcc -version 2>&1')
a = 1
b = gcc: error: unrecognized command-line option '-version'
gcc: fatal error: no input files
compilation terminated.
octave:8> a = system('gcc -version 2>&1')
gcc: error: unrecognized command-line option '-version'
a = 1
octave:9>
Redirecting stderr to a file also only works in the two-output form.
I don't know which part of that worked before. But I'd guess that at least
part of this is a regression from hg id 96b2c2206e88.
I'll try to look into what is happening and how that could be resolved.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?68006>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
(application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQQk97aszIMMAvLLwm6qLAuaBUf3TgUCaYL4bAAKCRCqLAuaBUf3 TkKEAQDlO90AxDHZYF32Kt2IQCbjPq4y9kBtoAJPiGKXR1GAPgD/RagLgpzsquO0 wdTUEnrLKoxxbqwNynHV+Q4m3orrtgE= =nZGv -----END PGP SIGNATURE-----