Problems with system() call.

2 views (last 30 days)
Clark
Clark on 4 Sep 2014
Answered: Clark on 12 Sep 2014
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

Answers (1)

Clark
Clark on 12 Sep 2014
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.

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!