Problems with system() call.

2 次查看(过去 30 天)
Clark
Clark 2014-9-4
回答: Clark 2014-9-12
This is breaking our production runs, thanks for the help.
We have R2013b executing on Ubuntu 14.04:
Linux kashmir 3.13.0-32-generic #57~precise1-Ubuntu SMP Tue Jul 15 03:51:20 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
Our job chokes on the empty 'user' variable:
>> [status, user] = system( 'echo -n $DB_FULL_USER' )
status =
0
user =
''
Ooops, next time we make the call we get an erroneous doublet:
>> [status, user] = system( 'echo -n $DB_FULL_USER' )
status =
0
user =
matlabmatlab
Then on the next call we go back to normal for a 'while':
>> [status, user] = system( 'echo -n $DB_FULL_USER' )
status =
0
user =
matlab
The painful thing is that this is years old code, never broke before. AFAIK it's intermittent. Very strange, and I don't know what to do about it other than to loop on system(), but that seems crazy. Anybody have any idea what's happening?
THANK YOU
Clark

回答(1 个)

Clark
Clark 2014-9-12
This post appears to be related:
Here we find that:
map = java.lang.System.getenv();
seems to be the means used by getenv() to attain its results.
whereas:
[ status, blahVal ] = system( 'echo -n $BLAH' )
could not "possibly" be using java. We're going to try switching our usage to getenv(). A few more days and we'll know if it's any better.

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by