* Bug #14223 fixed - det returned an error when it is used with a singular matrix.
+* Bug #14225 fixed - command-line option "-quit" should set the processs Exit status
+
* Bug #14232 fixed - Typos in Xcos.
class StaticRunner
{
public:
- static void launch(void);
+ static int launch(void);
static void setRunner(Runner* _RunMe);
static Runner* getRunner(void);
static bool isRunnerAvailable(void);
ThreadManagement::SetThreadKey( __GetCurrentThreadKey(), threadKeyCommand, threadKeyConsole);
#endif // DEBUG_THREAD
+ int iRet = 0;
do
{
// wait for available runner
try
{
- StaticRunner::launch();
+ iRet = StaticRunner::launch();
}
catch (const ast::InternalAbort& /*ia*/)
{
// go out when exit/quit is called
+ iRet = ConfigVariable::getExitStatus();
}
- catch (const ast::RecursionException& /*ia*/)
+ catch (const ast::RecursionException& /*re*/)
{
// go out when exit/quit is called
+ iRet = 1;
}
+
ThreadManagement::SendAwakeRunnerSignal();
}
while (ConfigVariable::getForceQuit() == false);
- return ConfigVariable::getExitStatus();
+ return iRet;
}
/*
/*
** -*- stateView
-** Used to show parser state.
-** Find if we are stuck within some control structure.
*/
static void stateShow(Parser::ControlStatus status)
{
- switch (status)
+ if (status != Parser::AllControlClosed)
{
- //case Parser::WithinFor:
- // SetTemporaryPrompt("-for ->");
- // break;
- //case Parser::WithinWhile:
- // SetTemporaryPrompt("-while ->");
- // break;
- //case Parser::WithinIf:
- // SetTemporaryPrompt("-if ->");
- // break;
- //case Parser::WithinElse:
- // SetTemporaryPrompt("-else ->");
- // break;
- //case Parser::WithinElseIf:
- // SetTemporaryPrompt("-elseif ->");
- // break;
- //case Parser::WithinTry:
- // SetTemporaryPrompt("-try ->");
- // break;
- //case Parser::WithinCatch:
- // SetTemporaryPrompt("-catch ->");
- // break;
- //case Parser::WithinFunction:
- // SetTemporaryPrompt("-function ->");
- // break;
- //case Parser::WithinSelect:
- // SetTemporaryPrompt("-select ->");
- // break;
- //case Parser::WithinCase:
- // SetTemporaryPrompt("-case ->");
- // break;
- //case Parser::WithinSwitch:
- // SetTemporaryPrompt("-switch ->");
- // break;
- //case Parser::WithinOtherwise:
- // SetTemporaryPrompt("-otherwise ->");
- // break;
- //case Parser::WithinMatrix:
- // SetTemporaryPrompt("- [ ->");
- // break;
- //case Parser::WithinCell:
- // SetTemporaryPrompt("- { ->");
- // break;
- //case Parser::WithinBlockComment:
- // SetTemporaryPrompt("- /* ->");
- // break;
- //case Parser::WithinDots:
- // SetTemporaryPrompt("- ... ->");
- // break;
- default :
- SetTemporaryPrompt(" > ");
- break;
- case Parser::AllControlClosed:
- //ClearTemporaryPrompt();
- break;
+ SetTemporaryPrompt(" > ");
}
}
}
}
-void StaticRunner::launch()
+int StaticRunner::launch()
{
+ int iRet = 0;
// get the runner to execute
std::unique_ptr<Runner> runMe(getRunner());
// set if the current comment is interruptible
ConfigVariable::whereErrorToString(ostr);
scilabErrorW(ostr.str().c_str());
ConfigVariable::resetWhereError();
+ iRet = 1;
}
catch (const ast::InternalAbort& ia)
{
//clean debugger step flag if debugger is not interrupted ( end of debug )
manager->resetStep();
+ return iRet;
}
void StaticRunner::setRunner(Runner* _RunMe)
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2015 - Scilab Enterprises - Cedric Delamarre
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- Non-regression test for bug 14225 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/14225
+//
+// <-- Short Description -->
+// command-line option "-quit" should set the processs Exit status
+if getos() == "Windows" then
+ scilabBin = SCI + "/bin/scilex ";
+else
+ scilabBin = SCI + "/bin/scilab-cli ";
+end
+//With -quit argument
+err = unix(scilabBin + "-e ""exit()"" -quit");
+assert_checkequal(err, 0);
+err = unix(scilabBin + "-e ""1+1;"" -quit");
+assert_checkequal(err, 0);
+err = unix(scilabBin + "-e ""1+1; exit(12)"" -quit");
+assert_checkequal(err, 12);
+err = unix(scilabBin + "-e ""error(\""error_test\"");"" -quit");
+assert_checkequal(err, 1);
+err = unix(scilabBin + "-e ""error(\""error_test\"");exit(12)"" -quit");
+assert_checkequal(err, 1);
+err = unix(scilabBin + "-e ""try, error(\""error_test\""); catch, disp(lasterror()),end"" -quit");
+assert_checkequal(err, 0);
+err = unix(scilabBin + "-e ""try, error(\""error_test\""); catch,disp(lasterror());exit(12), end"" -quit");
+assert_checkequal(err, 12);
+//Without -quit argument
+err = unix(scilabBin + "-e ""exit()""");
+assert_checkequal(err, 0);
+err = unix(scilabBin + "-e ""1+1; exit(12)""");
+assert_checkequal(err, 12);
+err = unix(scilabBin + "-e ""try, error(\""error_test\""); catch,disp(lasterror());exit(12), end""");
+assert_checkequal(err, 12);
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2015 - Scilab Enterprises - Cedric Delamarre
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- Non-regression test for bug 14225 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/14225
+//
+// <-- Short Description -->
+// command-line option "-quit" should set the processs Exit status
+
+if getos() == "Windows" then
+ scilabBin = SCI + "/bin/scilex ";
+else
+ scilabBin = SCI + "/bin/scilab-cli ";
+end
+
+//With -quit argument
+err = unix(scilabBin + "-e ""exit()"" -quit");
+assert_checkequal(err, 0);
+err = unix(scilabBin + "-e ""1+1;"" -quit");
+assert_checkequal(err, 0);
+err = unix(scilabBin + "-e ""1+1; exit(12)"" -quit");
+assert_checkequal(err, 12);
+err = unix(scilabBin + "-e ""error(\""error_test\"");"" -quit");
+assert_checkequal(err, 1);
+err = unix(scilabBin + "-e ""error(\""error_test\"");exit(12)"" -quit");
+assert_checkequal(err, 1);
+err = unix(scilabBin + "-e ""try, error(\""error_test\""); catch, disp(lasterror()),end"" -quit");
+assert_checkequal(err, 0);
+err = unix(scilabBin + "-e ""try, error(\""error_test\""); catch,disp(lasterror());exit(12), end"" -quit");
+assert_checkequal(err, 12);
+
+//Without -quit argument
+err = unix(scilabBin + "-e ""exit()""");
+assert_checkequal(err, 0);
+err = unix(scilabBin + "-e ""1+1; exit(12)""");
+assert_checkequal(err, 12);
+err = unix(scilabBin + "-e ""try, error(\""error_test\""); catch,disp(lasterror());exit(12), end""");
+assert_checkequal(err, 12);
+