exit-code

How to capture the Gradle exit code in a shell script?

让人想犯罪 __ 提交于 2020-01-31 09:03:04
问题 I would like to capture the return code of a Gradle task. Here is a small bash script draft which executes a tasks: #!/bin/bash gradlew_return_code=`./gradlew assembleDebug` echo ">>> $gradlew_return_code" if [ "$gradlew_return_code" -eq "0" ]; then echo "Gradle task succeeded." else echo "Gradle task failed." fi The script does not store the return value but instead the whole console output of the Gradle task. Please note that the example script is a simplification of a more complex script

Getting exit status code from 'ftp' command in linux shell

徘徊边缘 提交于 2020-01-20 18:11:42
问题 I need to retrive the exit status code from a command line program. No worries, I used $?. But for ftp, even if it doesn't connect, it opens the ftp shell, so I'm not able to understand that the connection haven't take place. Try this code for understand: #!/bin/sh ftp 1234567 OUT=$? if [ $OUT -eq 0 ];then echo "ftp OK" else echo "ftp Error: "$OUT fi exit 0 Any help? Thanks Filippo 回答1: You should be looking for success message from ftp command rather than looking for a status. It's "226

Getting exit status code from 'ftp' command in linux shell

和自甴很熟 提交于 2020-01-20 18:11:28
问题 I need to retrive the exit status code from a command line program. No worries, I used $?. But for ftp, even if it doesn't connect, it opens the ftp shell, so I'm not able to understand that the connection haven't take place. Try this code for understand: #!/bin/sh ftp 1234567 OUT=$? if [ $OUT -eq 0 ];then echo "ftp OK" else echo "ftp Error: "$OUT fi exit 0 Any help? Thanks Filippo 回答1: You should be looking for success message from ftp command rather than looking for a status. It's "226

Unexpected exit status when using -pass-exit-codes in g++

这一生的挚爱 提交于 2020-01-16 03:25:48
问题 When doing the following, the exit code of the failed compilation is 1, however, based on this, I would expect it to be >=3. Why is this? What can I do if I want more detailed exit codes than binary success/fail? > echo "int main() {fail}" > fail.cpp > g++ -pass-exit-codes fail.cpp -o fail fail.cpp: In function ‘int main()’: fail.cpp:1: error: ‘fail’ was not declared in this scope fail.cpp:1: error: expected ';' before ‘}’ token > echo $? 1 > g++ --version g++ (GCC) 4.1.3 20080704 (Red Hat 4

Application exiting with an exit code of -1073740771

家住魔仙堡 提交于 2020-01-13 10:10:32
问题 I have a WPF application, which sometimes is exiting with an exit code of -1073740771. The issue is not occurring in any pattern and it's varying from system to system. In some system the issue is occurring for less that 10% of the total cases and in other system I am seeing it occurring at a rate of almost 30% of the total cases. I haven't been able to form any solid repro steps and it seems to be happening at random. The symptoms include that after I have clicked the close button, the

How to capture the exit status of a shell command in Java?

人盡茶涼 提交于 2020-01-13 08:39:11
问题 I'm creating a Junit test file for my CSVreader. I'm reading the contents of CSV files and writing the contents into another file. I want to compare them using diff utility and I want to use the exit status of diff to know whether the contents are same or not. Generally $? gives the exit status but I don't know how to capture it and use it in my code. Can anyone help me in this regard? This is how my code looks boolean hasSameContents = false; command="diff "+mp.get("directory")+"/"+fileName+

How exactly works the Java application exit code of the main() method?

无人久伴 提交于 2020-01-12 06:37:06
问题 I have the following doubts related a simple command line Java application. So I have this command line application that is started by a main() method defined inside a Main class. As usual this main() method is defined with this signature: public static void main(String[] args) { It's return type is void , and that should mean it doesn't return any value. But when its execution correctly terminates I obtain following message in the IntelliJ console. Disconnected from the target VM, address:

How can I set the exit code in Inno Setup?

﹥>﹥吖頭↗ 提交于 2020-01-11 02:31:07
问题 I want to set the exit code for my installation, this way I will know why the installation was aborted. I'm using Inno Setup. 回答1: Use: [Code] procedure ExitProcess(exitCode:integer); external 'ExitProcess@kernel32.dll stdcall'; procedure SomeEventHere(); begin if someerror then begin ExitProcess(9); //Your custom exit code end; end; 回答2: From the Inno Setup Help document (from the article "Setup Exit Codes"): Beginning with Inno Setup 3.0.3, the Setup program may return one of the following

How can I set the exit code in Inno Setup?

梦想与她 提交于 2020-01-11 02:31:05
问题 I want to set the exit code for my installation, this way I will know why the installation was aborted. I'm using Inno Setup. 回答1: Use: [Code] procedure ExitProcess(exitCode:integer); external 'ExitProcess@kernel32.dll stdcall'; procedure SomeEventHere(); begin if someerror then begin ExitProcess(9); //Your custom exit code end; end; 回答2: From the Inno Setup Help document (from the article "Setup Exit Codes"): Beginning with Inno Setup 3.0.3, the Setup program may return one of the following

exit from powershell script causes Unhandled exception

这一生的挚爱 提交于 2020-01-07 04:41:20
问题 I am trying to execute exit after closing the form when clicking "NO" button, but exit causes a system error Code: function No { $Form.close() exit } $NoButton.Add_Click({No}) Without exit, it closes the form but it continues executing the script System error: Unhandled exception has occured in a component in your application. If you click Continue, the application will ignore this error and attempt to continue. System error. Full button code: function No { $Form.close() exit } #end No # No