Skip to content

Commit

Permalink
- get the proper process exit code for System.systemCall command on W…
Browse files Browse the repository at this point in the history
…indows

- put the error code inside the Model.log file
- remove Compiler/scripts/CompileMSVC.bat as is not used


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@24535 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Feb 11, 2015
1 parent 0d5d781 commit 0b2f124
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
7 changes: 5 additions & 2 deletions Compiler/runtime/systemimpl.c
Expand Up @@ -549,6 +549,7 @@ int runProcess(const char* cmd)
PROCESS_INFORMATION pi;
char *c = "cmd /c";
char *command = malloc(strlen(cmd) + strlen(c) + 2);
DWORD exitCode = 1;

ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
Expand All @@ -562,13 +563,15 @@ int runProcess(const char* cmd)
if (CreateProcessA(NULL, command, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi))
{
WaitForSingleObject(pi.hProcess, INFINITE);
// Get the exit code.
GetExitCodeProcess(pi.hProcess, &exitCode);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
free(command);
return 0;
return (int)exitCode;
}
free(command);
return 1;
return (int)exitCode;
}
#endif

Expand Down
7 changes: 5 additions & 2 deletions Compiler/scripts/Compile.bat
Expand Up @@ -35,18 +35,21 @@ REM Clear all environment variables that may interfere during compile and link p
set MAKE=
set MAKEFLAGS=
nmake /a /f %1.makefile >> %1.log 2>&1
set RESULT=%ERRORLEVEL%
echo RESULT: %RESULT% >> %1.log 2>&1
goto :Final


:MINGW
REM echo "MINGW"
if "%3"=="parallel" set ADDITIONAL_ARGS=-j%NUMBER_OF_PROCESSORS%
%MinGW%\bin\mingw32-make -f %1.makefile %ADDITIONAL_ARGS% >> %1.log 2>&1
set RESULT=%ERRORLEVEL%
echo RESULT: %RESULT% >> %1.log 2>&1
goto :Final


:Final
set RESULT=%ERRORLEVEL%
set PATH=%OLD_PATH%
set OLD_PATH=
exit %RESULT%
@%COMSPEC% /C exit %RESULT%
4 changes: 0 additions & 4 deletions Compiler/scripts/CompileMSVC.bat

This file was deleted.

0 comments on commit 0b2f124

Please sign in to comment.