exit-code

Running code on program exit in Java

一曲冷凌霜 提交于 2019-12-17 06:12:40
问题 Is it possible to write a method that System.exit will call when you terminate a program? 回答1: Use Runtime.getRuntime().addShutdownHook(Thread). 回答2: Shutdown hooks are the answer... here is an article on them. They do not come without issues (some of them are discussed in the article). 回答3: You can use a shutdown hook. http://download.oracle.com/javase/6/docs/api/java/lang/Runtime.html#addShutdownHook(java.lang.Thread) Note that shutdown hooks will not run if the VM aborts abnormally or

Retrieve exit status from php script inside of shell script

随声附和 提交于 2019-12-14 00:19:50
问题 I have a bash shell script that calls a few PHP scripts like this. #!/bin/bash php -f somescript.php php -f anotherscript.php I want to compose an error log and/or an activity report based on the results of those scripts. Is there any way I can get the exit status of the php script in the shell script? I could either use integer exit statuses or string messages. 回答1: You can easily catch the output using the backtick operator, and get the exit code of the last command by using $? : #!/bin

Windows Task Scheduler reports incorrect/inconsistent result code

拟墨画扇 提交于 2019-12-13 15:43:04
问题 Background: I am attempting to get email notification upon failure of a scheduled task. My task can indicate failure via exit code (errorlevel) and I want to use that and follow the filter approach described in this answer to trigger an email. Problem: I am getting inconsistent behavior from Task Scheduler on different machines and versions of Windows. To test, I'm using the following very simple task. Run only when user is logged on. (where "user" is the current user) Action: Start a program

How to get the testCafe exit code

馋奶兔 提交于 2019-12-13 13:41:56
问题 I am having an issue running Testcafe through cucumber. for whatever reason, When I run testCafe through cucumber, the process will always exit with exit code 0 even in the test fails. If I run puppeteer through cucumber I don't get this issue. I am thinking that this behavior is due to the way I have things set up in my hooks file where I am not properly interpreting the test cafe exit code. In my hooks file, I am creating a testCafe runner and in my Before hook and then closing it during my

Can a batch file capture the exit codes of the commands it is invoking?

青春壹個敷衍的年華 提交于 2019-12-13 11:37:44
问题 Basically, let's say that I have a batch file that calls myapp1.exe and myapp1.exe exits with Exit Code 1. Can the batch file capture this information and either force the batch file to exit with that same exit code or perform some other logic? 回答1: @echo off rem ... set errorlevel= MyApp1.exe exit /b %errorlevel% would be the explicit variant. 回答2: You could try using errorlevels. Some more info here. 回答3: The accepted answer is correct, but if you are using call to call another batch script

setData raises exit code -1073741819

醉酒当歌 提交于 2019-12-13 05:47:18
问题 I have a subclass of QtGui.QStandardItemModel with setData as follow: def setData(self, index, value, role): if role == QtCore.Qt.EditRole: old = self.itemFromIndex(index).text() new = value MAIN.changeItem(old,new,index) return QtGui.QStandardItemModel.setData(self, index, value, role) In MAIN.changeItem I take the 'old' value and replace it with the 'new' in the Database and and then I setData with the return value. And finally I refresh the Model to show the result. Like so: def changeItem

(GitKraken) Pre-commit Failed Exit Code: 1

自古美人都是妖i 提交于 2019-12-13 05:38:42
问题 I'm using GitKraken (not sure if relevant) and as I'm trying to commit, I get this error message: And as I press the button "View Hook Output" I get the following: pre-commit husky > npm run -s precommit (node v8.9.4)[?25l npm > Running tasks for src/**/*.js \ yarn format git add (...lots of these two rows...) \ yarn format git add "yarn format" found some errors. Please fix them and try committing again. yarn run v1.6.0 $ prettier-standard './src/**/*.js' C:\mypath\myfile.js info[Visit [0

segmentation fault at __tcf_0 when program exits

一笑奈何 提交于 2019-12-13 03:33:37
问题 when program exits, the information is given: *** glibc detected *** double free or corruption (!prev): 0x09a8fcb8 *** It seems like double free at one object. Then I used gdb to debug the coredump file. The following is the bt result(more traces are not posted): #0 0x005197a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2 #1 0x0055a825 in raise () from /lib/tls/libc.so.6 #2 0x0055c289 in abort () from /lib/tls/libc.so.6 #3 0x0058ecda in __libc_message () from /lib/tls/libc.so.6 #4

subprocesses from apache returning exit code -6 with not stdout or stderr

社会主义新天地 提交于 2019-12-12 20:03:32
问题 When running "git status" or even "ls" from an apache process, I will frequently get no standard output or error, and an exit status code of -6. Other times, it just works. Any ideas why this is occurring or what it means? 回答1: If you are on a network with a lot of people, you may be running out of available concurrent connections. This assumes you are on Linux when you talk about your remote. The default of 10 concurrent secure collections is not enough if you have lots of simultaneous

how to get the exit code of other application in nsis

为君一笑 提交于 2019-12-12 12:34:04
问题 In my .nsi file I am calling ExecWait '"$INSTDIR\application.exe" ' $0 . In application.exe I am returning exit codes for success and failures. How to catch those exit codes in .nsi file. 回答1: If there is an error performing ExecWait, then the contents of the user variable passed in is undefined. To simply check if the program executed correctly or not, check the error flag. (btw, NSIS expects zero for success and non-zero for error) ClearErrors ExecWait '"$INSTDIR\application.exe"' IfErrors