bugGNU Octave - Bugs: bug #44712, system() don't capture STDERR...

 
 

bug #44712: system() don't capture STDERR screen output

Submitter:  sergey plotnikov <nul0m>
Submitted:  Fri 03 Apr 2015 12:33:54 PM UTC
   
 
Category:  Octave Function Severity:  2 - Minor
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 26 Mar 2019 03:50:47 AM UTC, comment #10: 

I think that's a good idea.

Andrew Janke <apjanke>
Tue 26 Mar 2019 03:42:53 AM UTC, comment #9: 

I think we should redirect stderr for compatibility with the Matlab 'system' function, and maybe later provide a different function that is more configurable, maybe with options similar to Python's subprocess library.

(Or maybe users could just call py.subprocess.run directly once I get pythonic going again.)

Mike Miller <mtmiller>
Group Member
Tue 26 Mar 2019 03:25:12 AM UTC, comment #8: 

Yes, we used to have many preference variables and it was a huge mistake that took many years to fix.  Let's not do that again.

We still to have some global preferences, but they mainly affect things like output formats or user interaction, not syntax or results a function returns.

John W. Eaton <jwe>
Group administrator
Tue 26 Mar 2019 02:13:32 AM UTC, comment #7: 


> Why don't we go with a user preference variable?


That sounds less than ideal. That's a global setting. And it's really the immediate caller in most cases that's going to know whether it wants stderr mixed in with stdout, because it's the one that's going to be doing parsing or processing or passing it on to some other context. An option to system() or a different system2() function seems like a better design; that way callers can individually choose which behavior they want.

Andrew Janke <apjanke>
Mon 04 May 2015 02:36:28 PM UTC, comment #6: 

in that case, i'd be for an extra option of "system" which reflects Matlab's behavior by default

sergey plotnikov <nul0m>
Mon 04 May 2015 02:27:52 PM UTC, comment #5: 

"--braindead", as I understand it, doesn't mean "make it Matlab compatible". It's not supposed to affect behaviour. Octave's goal is already to be to behave like Matlab. The --braindead option is only for superficial cosmetic differences that don't really impact behaviour, such as changing the default prompt or the default matrix display formats.

Jordi GutiƩrrez Hermoso <jordigh>
Group Member
Mon 04 May 2015 02:05:55 PM UTC, comment #4: 

Why don't we go with a user preference variable?.. In this case I'd expect it to be a part of "--braindead" option (redirecting all to stdout).

sergey plotnikov <nul0m>
Mon 04 May 2015 01:47:24 PM UTC, comment #3: 

Perhaps we should have a version of system (with a different name, or as an option) that can capture stderr separately, or let it go to stderr if the user wants that behavior?  It really seems better to me to not redirect stderr to stdout unless requested.

John W. Eaton <jwe>
Group administrator
Sun 03 May 2015 10:39:45 PM UTC, comment #2: 

Marking as confirmed Matlab incompatibility: both stdout and stderr together should be returned in the output string.

Changing this for the 4.0 release might break some expectations in existing code.

Mike Miller <mtmiller>
Group Member
Fri 03 Apr 2015 03:04:48 PM UTC, comment #1: 

I posted this issue before, and someone provided a workaround:

[st, out] = system ('foo 2>&1');

This solved my problem, but I still think it is better to make the behavior consistent.

Anonymous
Fri 03 Apr 2015 12:33:54 PM UTC, original submission:  

As far as I can tell Matlab captures everything if system() is called with two output arguments and suppresses all error messages.

Matlab:

>> [st, out] = system ('foo');
>> out
out =
/bin/bash: foo: command not found



Octave:

>> [st, out] = system ('foo');
sh: 1: foo: not found
>> out
out =


sergey plotnikov <nul0m>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Carbon-Copy List
  • -email is unavailable- added by apjanke (Posted a comment)
  • -email is unavailable- added by cbm
  • -email is unavailable- added by jordigh (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by nul0m (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-08-06 rik5 Dependencies- bugs #56722 is dependent
    2016-07-17 cbm Carbon-Copy- Added cbm
    2015-12-27 rik5 Dependencies- bugs #46754 is dependent
    2015-05-03 mtmiller CategoryNone Octave Function
        Severity3 - Normal 2 - Minor
        StatusNone Confirmed
        Release4.0.0-rc2 dev

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code