bugGNU Octave - Bugs: bug #43716, system function won't capture...

 
 

bug #43716: system function won't capture screen output for some external commnad

Submitter:  Xiangrui Li <xiangrui>
Submitted:  Thu 27 Nov 2014 06:22:56 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Works For Me Assigned to:  None
Originator Name:  Xiangrui Li Open/Closed:  * Closed
Release:  * 3.8.1 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 19 Dec 2014 11:33:10 PM UTC, comment #4: 

But shouldn't system capture stderr as well? As far as I can tell Matlab captures everything..

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>
Fri 28 Nov 2014 09:37:49 PM UTC, comment #3: 

Thanks for confirming the workaround works for you. This probably means that gzip 1.2.4 prints its version to stderr instead of stdout.

Mike Miller <mtmiller>
Group Member
Fri 28 Nov 2014 09:22:52 PM UTC, comment #2: 

The gzip version is 1.2.4 under Windows. The one under Linux comes with Ubuntu 14.04, and I don't know its version since I have no access to it now.

The "2>&1" trick works perfectly for me under Windows (Octave 3.6.4), and I guess it will work under Linux for Octave 3.8.1. It also works fine for other command. If a command does not exist, the error message goes to cmdout.

Actually my current purpose is to check whether external compression command, like pigz, gzip, exists. If yes, I would use them, since they are faster than Matlab/Octave built-in gzip.m.

This trick won't affect Matlab behavior, so I have simple fix for now. Thank you very much.
 

Xiangrui Li <xiangrui>
Fri 28 Nov 2014 02:33:54 PM UTC, comment #1: 

Thanks for your bug report. This works fine for me with Octave 3.8.1 on linux.

What is the version of gzip that is output to the screen? Is it possible that your version of gzip is sending the version to stderr  while mine is going to stdout? Does


[status, cmdout] = system ("gzip -V 2>&1")


work for you?

Mike Miller <mtmiller>
Group Member
Thu 27 Nov 2014 06:22:56 PM UTC, original submission:  

Following captures the output as expected:
[status, cmdout]= system('dir'); % same for 'echo dsfa' etc

However, following still gives screen output, and cmdout is empty:
[status, cmdout]= system('gzip -V');

In Matlab, there is no screen output for both above cases, and the  screen output always goes to cmdout.

The behavior is the same for Windows 7 and Linux.

Xiangrui Li <xiangrui>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by nul0m (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by xiangrui (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 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-11-28 mtmiller Open/ClosedOpen Closed
    2014-11-28 mtmiller StatusNone Works For Me

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code