replace processExecuted with processSuccessed

This commit is contained in:
Syping 2019-09-30 20:23:47 +02:00
parent 71c86ba217
commit 49545db0dc

View file

@ -37,7 +37,7 @@ int LuaEngineOS::executeProcess(lua_State *L_p)
if (getArgumentCount(L_p) >= 1) {
int processReturn = 0;
bool runInBackground = false;
bool processExecuted = false;
bool processSuccessed = false;
if (getArgumentCount(L_p) >= 2) {
QVariantList arguments = getArguments(L_p);
QVariant lastArgument = arguments.last();
@ -53,7 +53,7 @@ int LuaEngineOS::executeProcess(lua_State *L_p)
processArguments << argument.toString();
}
if (runInBackground) {
processExecuted = QProcess::startDetached(processPath, processArguments);
processSuccessed = QProcess::startDetached(processPath, processArguments);
}
else {
processReturn = QProcess::execute(processPath, processArguments);
@ -61,7 +61,7 @@ int LuaEngineOS::executeProcess(lua_State *L_p)
}
else {
if (runInBackground) {
processExecuted = QProcess::startDetached(arguments.first().toString());
processSuccessed = QProcess::startDetached(arguments.first().toString());
}
else {
processReturn = QProcess::execute(arguments.first().toString());
@ -71,13 +71,13 @@ int LuaEngineOS::executeProcess(lua_State *L_p)
else {
processReturn = QProcess::execute(getVariant(L_p, 1).toString());
}
if (runInBackground && !processExecuted) {
if (runInBackground && !processSuccessed) {
processReturn = -2;
}
else if (!runInBackground && processReturn != -2) {
processExecuted = true;
else if (!runInBackground && processReturn == 0) {
processSuccessed = true;
}
pushVariant(L_p, processExecuted);
pushVariant(L_p, processSuccessed);
pushVariant(L_p, processReturn);
return 2;
}