diff options
author | Ignacio Burgueño <iburgueno@gmail.com> | 2015-05-05 08:55:03 -0300 |
---|---|---|
committer | Ignacio Burgueño <iburgueno@gmail.com> | 2015-05-05 08:55:03 -0300 |
commit | 70c75776c2d8771c6d66dd4d5facbb4e55a1148e (patch) | |
tree | b0a5f06cf156c48e6279ba4e7e12d7a2a5833928 | |
parent | 0d071fa685e41864986c9537efe0bca80d69c280 (diff) | |
parent | 11b8b48978118e5cc4e30f63274c63245cecb6ef (diff) | |
download | luarocks-70c75776c2d8771c6d66dd4d5facbb4e55a1148e.tar.gz luarocks-70c75776c2d8771c6d66dd4d5facbb4e55a1148e.tar.bz2 luarocks-70c75776c2d8771c6d66dd4d5facbb4e55a1148e.zip |
Merge pull request #366 from Tieske/windows_exitcode
Provide proper exitcode on windows
-rw-r--r-- | install.bat | 5 | ||||
-rw-r--r-- | src/luarocks/fs/win32.lua | 1 |
2 files changed, 4 insertions, 2 deletions
diff --git a/install.bat b/install.bat index 52d21355..ffde28db 100644 --- a/install.bat +++ b/install.bat | |||
@@ -729,7 +729,8 @@ IF NOT "%LUA_PATH_5_3%"=="" ( | |||
729 | ) | 729 | ) |
730 | SET "PATH=$BINDIR;%PATH%" | 730 | SET "PATH=$BINDIR;%PATH%" |
731 | "$LUA_BINDIR\$LUA_INTERPRETER" "$BINDIR\]]..c..[[.lua" %* | 731 | "$LUA_BINDIR\$LUA_INTERPRETER" "$BINDIR\]]..c..[[.lua" %* |
732 | IF NOT "%ERRORLEVEL%"=="2" GOTO EXITLR | 732 | SET EXITCODE=%ERRORLEVEL% |
733 | IF NOT "%EXITCODE%"=="2" GOTO EXITLR | ||
733 | 734 | ||
734 | REM Permission denied error, try and auto elevate... | 735 | REM Permission denied error, try and auto elevate... |
735 | REM already an admin? (checking to prevent loops) | 736 | REM already an admin? (checking to prevent loops) |
@@ -758,7 +759,7 @@ ECHO Now retrying as a priviledged user... | |||
758 | PowerShell -Command (New-Object -com 'Shell.Application').ShellExecute('%TMPFILE%', '', '', 'runas') | 759 | PowerShell -Command (New-Object -com 'Shell.Application').ShellExecute('%TMPFILE%', '', '', 'runas') |
759 | 760 | ||
760 | :EXITLR | 761 | :EXITLR |
761 | ENDLOCAL | 762 | exit /b %EXITCODE% |
762 | ]]) | 763 | ]]) |
763 | f:close() | 764 | f:close() |
764 | print(S"Created LuaRocks command: $BINDIR\\"..c..".bat") | 765 | print(S"Created LuaRocks command: $BINDIR\\"..c..".bat") |
diff --git a/src/luarocks/fs/win32.lua b/src/luarocks/fs/win32.lua index 12d86d1d..32766e53 100644 --- a/src/luarocks/fs/win32.lua +++ b/src/luarocks/fs/win32.lua | |||
@@ -125,6 +125,7 @@ function win32.wrap_script(file, dest, name, version) | |||
125 | local ppaths = "package.path="..util.LQ(lpath..";").."..package.path; package.cpath="..util.LQ(lcpath..";").."..package.cpath" | 125 | local ppaths = "package.path="..util.LQ(lpath..";").."..package.path; package.cpath="..util.LQ(lcpath..";").."..package.cpath" |
126 | local addctx = "local k,l,_=pcall(require,"..util.LQ("luarocks.loader")..") _=k and l.add_context("..util.LQ(name)..","..util.LQ(version)..")" | 126 | local addctx = "local k,l,_=pcall(require,"..util.LQ("luarocks.loader")..") _=k and l.add_context("..util.LQ(name)..","..util.LQ(version)..")" |
127 | wrapper:write(fs.Qb(lua)..' -e '..fs.Qb(ppaths)..' -e '..fs.Qb(addctx)..' '..fs.Qb(file)..' %*\n') | 127 | wrapper:write(fs.Qb(lua)..' -e '..fs.Qb(ppaths)..' -e '..fs.Qb(addctx)..' '..fs.Qb(file)..' %*\n') |
128 | wrapper:write("exit /b %ERRORLEVEL%\n") | ||
128 | wrapper:close() | 129 | wrapper:close() |
129 | return true | 130 | return true |
130 | end | 131 | end |