exit-code

Getting the exit code of an application started with the “cmd” and “start” commands

Deadly 提交于 2020-07-05 06:46:49
问题 I have a console application. Interaction with this application is done via TCP/IP. I also have a test framework for it, which is basically a collection of BATCH scripts (...not my fault). What this test framework does for each test is basically this: start /min "myapplication.exe" and wait until verification is received that the application is up and running. send commands via TCP/IP to this application, receive its replies, and check if the timings and values agree with whatever is expected

Getting exit code out of docker-compose up

六月ゝ 毕业季﹏ 提交于 2020-05-09 06:36:09
问题 I have an issue getting an exit code out of docker-compose up . I have the simplest container that runs a script that always exits with 1: #!/usr/bin/env sh exit 1 My Dockerfile: FROM mhart/alpine-node:6 RUN mkdir /app WORKDIR /app And my docker-compose.yml: version: '2' services: test_container: container_name: test_container build: . volumes: - ${PWD}/run.sh:/app/run.sh entrypoint: ["/app/run.sh"] When I run it with docker-compose -f docker-compose.yml up --force-recreate test_container I

Use of System.exit(0) [duplicate]

元气小坏坏 提交于 2020-05-06 15:34:12
问题 This question already has answers here : Difference in System. exit(0) , System.exit(-1), System.exit(1 ) in Java (11 answers) Closed 2 years ago . public class WrapperTest { static { print(10); } static void print(int x) { System.out.println(x); System.exit(0); } } In the above code System.exit(0) is used to stop the program. What argument does that method take? Why do we gave it as 0 . Can anyone explain the concept? 回答1: From the JAVA Documentation: The argument serves as a status code; by

Use of System.exit(0) [duplicate]

时光怂恿深爱的人放手 提交于 2020-05-06 15:33:09
问题 This question already has answers here : Difference in System. exit(0) , System.exit(-1), System.exit(1 ) in Java (11 answers) Closed 2 years ago . public class WrapperTest { static { print(10); } static void print(int x) { System.out.println(x); System.exit(0); } } In the above code System.exit(0) is used to stop the program. What argument does that method take? Why do we gave it as 0 . Can anyone explain the concept? 回答1: From the JAVA Documentation: The argument serves as a status code; by

How to prevent exit of host and return exit code?

梦想与她 提交于 2020-04-10 05:18:07
问题 Ansgar Wiechers' answer works well whenever starting a new PowerShell process. https://stackoverflow.com/a/50202663/447901 This works in both cmd.exe and powershell.exe. C:>type .\exit1.ps1 function ExitWithCode($exitcode) { $host.SetShouldExit($exitcode) exit $exitcode } ExitWithCode 23 In a cmd.exe interactive shell. C:>powershell -NoProfile -Command .\exit1.ps1 C:>echo %ERRORLEVEL% 23 C:>powershell -NoProfile -File .\exit1.ps1 C:>echo %ERRORLEVEL% 23 In a PowerShell interactive shell. PS C

How to call an exe when Inno Setup installation fails (within the installer itself)?

别来无恙 提交于 2020-02-28 11:01:31
问题 I've been using Inno Setup for several months now, but I'm struggling to find how to detect, from within the installer itself, an error that would cause Inno Setup to end with a non-zero exit code. I've thought about using CurStepChanged with the ssDone step, or even DeinitializeSetup , but I can't find how to get access to the wizard's exit-code. Did I miss something? There must be a way to do it... 回答1: You cannot find out installer exit code from the Pascal Scripting. If you want to detect

How to call an exe when Inno Setup installation fails (within the installer itself)?

匆匆过客 提交于 2020-02-28 11:01:06
问题 I've been using Inno Setup for several months now, but I'm struggling to find how to detect, from within the installer itself, an error that would cause Inno Setup to end with a non-zero exit code. I've thought about using CurStepChanged with the ssDone step, or even DeinitializeSetup , but I can't find how to get access to the wizard's exit-code. Did I miss something? There must be a way to do it... 回答1: You cannot find out installer exit code from the Pascal Scripting. If you want to detect

Powershell with Git Command Error Handling - automatically abort on non-zero exit code from external program

扶醉桌前 提交于 2020-02-25 04:18:21
问题 I use Git to deploy my web application. So in Teamcity I prepare my application (compilation, minify JS and HTML, delete unused files, etc...) and then I have a Powershell build step : $ErrorActionPreference = "Stop" git init git remote add origin '%env.gitFolder%' git fetch git reset --mixed origin/master git add . git commit -m '%build.number%' git push origin master But if an exception throw, the script continue (even if I set $ErrorActionPreference = "Stop" ) and the build is successful.

Powershell with Git Command Error Handling - automatically abort on non-zero exit code from external program

﹥>﹥吖頭↗ 提交于 2020-02-25 04:18:10
问题 I use Git to deploy my web application. So in Teamcity I prepare my application (compilation, minify JS and HTML, delete unused files, etc...) and then I have a Powershell build step : $ErrorActionPreference = "Stop" git init git remote add origin '%env.gitFolder%' git fetch git reset --mixed origin/master git add . git commit -m '%build.number%' git push origin master But if an exception throw, the script continue (even if I set $ErrorActionPreference = "Stop" ) and the build is successful.

Propagating exit code from exec'd batch file back to ant

99封情书 提交于 2020-02-02 03:05:10
问题 I need to call sbt from ant. I'm doing this with the "exec" task as follows: <target name="publish-jar"> <exec executable="sbt.bat" failonerror="true"> <arg value="publish"/> </exec> </target> I need the ant task to "fail" if the sbt task fails, which is why failonerror="true" is being used. However, this does not work. When the sbt task fails, ant does not report a failed build. This looks like the problem discussed here: Ant exec resultproperty is not working. The suggested workaround is to