[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #56600] 'system' commnad returns pid for async

From: Richard
Subject: [Octave-bug-tracker] [bug #56600] 'system' commnad returns pid for async process, not on Matlab
Date: Tue, 9 Jul 2019 17:51:26 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:67.0) Gecko/20100101 Firefox/67.0

Follow-up Comment #3, bug #56600 (project octave):

ok, it's not quite what I thought.

In Matlab the equivalent to 'async' is just to end the command with the
ampersand character. In Octave if you do the following:

>> [s, res] = system ('sleep 5 &')
s = 0
res =

The process is not asynchronous, it waits for the result. On matlab it does
not, and res is empty, i.e. the following returns immediately:

>> [s, res] = system ('sleep 5 &')

s =


res =

  0×0 empty char array

On Octave however, if you don't ask for the return argument, res, i.e.

>> s = system ('sleep 5 &')
s = 0

It does actually run asynchronously, or at least Octave doesn't seem to wait
for the result. 


>> system ('sleep 5 &')

appears to return immediately on both Matlab and Octave.

I think this has confused me into thinking that on Octave, the "async" keyword
was required to run a process asynchronously. So there is a subtle
incompatibility (if you ask for the second return argument Octave always
waits, Matlab doesn't), just not what I thought.

The documentation states that the status command holds the pid of the shell if
it is run asynchronously, but this is not the case if you just used the
ampersand character to achieve this.


Reply to this item at:


  Message sent via Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]