Skip to content

Commit

Permalink
support negative exit code.
Browse files Browse the repository at this point in the history
  • Loading branch information
nazoking committed Dec 6, 2014
1 parent 9ce2233 commit 0750e98
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
@echo off

if "%@@APP_ENV_NAME@@_HOME%"=="" set "@@APP_ENV_NAME@@_HOME=%~dp0\\.."
set ERROR_CODE=0

set "APP_LIB_DIR=%@@APP_ENV_NAME@@_HOME%\lib\"

Expand Down Expand Up @@ -130,12 +129,7 @@ rem Call the application and pass all arguments unchanged.

@endlocal

if ERRORLEVEL 1 goto error
goto end

:error
set ERROR_CODE=1

:end

exit /B %ERROR_CODE%
exit /B %ERRORLEVEL%
4 changes: 3 additions & 1 deletion src/sbt-test/windows/test-bat-template/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ TaskKey[Unit]("check-script") <<= (stagingDirectory in Universal, name, streams)
// include space and double-quote is failed...
// can't success include double-quote. arguments pass from Process(Seq("-Da=xx\"yy", "aa\"bb")) is parsed (%1="-Da", %2="xx\"yy aa\"bb") by cmd.exe ...
//checkOutput(0, "arg #0 is [xx\"yy]\nproperty(test.hoge) is [aa\"bb]\nvmarg #0 is [-Dtest.hoge=aa\"bb]\nSUCCESS!", "-Dtest.hoge=aa\"bb", "xx\"yy")
checkOutputEnv(Map("return-code-1"->"true"), 1, "arg #0 is [RC1]\nFAILURE!", "RC1")
checkOutputEnv(Map("return-code"->"1"), 1, "arg #0 is [RC1]\nFAILURE!", "RC1")
checkOutputEnv(Map("return-code"->"2"), 2, "arg #0 is [RC2]\nFAILURE!", "RC2")
checkOutputEnv(Map("return-code"->"-1"), -1, "arg #0 is [RC-1]\nFAILURE!", "RC-1")
assert(fails.toString == "", fails.toString)
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ object Test extends App {
println("vmarg #" + i + " is [" + x + "]")
}
}
if(System.getenv("return-code-1") == "true"){
if(System.getenv("return-code") != null){
println("FAILURE!")
System.exit(1)
System.exit(System.getenv("return-code").toInt)
} else {
println("SUCCESS!")
System.exit(0)
Expand Down

0 comments on commit 0750e98

Please sign in to comment.