exit-code

Windows command interpreter: how to obtain exit code of first piped command

人盡茶涼 提交于 2019-11-27 13:38:00
In the example provided below, I execute nmake and then redirect STDOUT/STDERR to tee, which then sends it to the screen, and also to a log file. The problem is that I'm trying to capture the exit code for nmake and not tee. What I need is the exit code from nmake, and not tee. nmake | tee output.txt You might think you could do something like the following, but it won't work. (nmake & call set myError=%%errorlevel%%) | tee output.txt The problem lies in the mechanism by which Windows pipes work. Each side of the pipe is executed in it's own CMD shell. So any environment variable you set there

Unit test script returns exit code = 0 even if tests fail

本秂侑毒 提交于 2019-11-27 12:54:52
问题 My testing script looks as follows: import os import sys from unittest import defaultTestLoader as loader, TextTestRunner path_to_my_project = os.path.dirname(os.path.abspath(__file__)) + '/../' sys.path.insert(0, path_to_my_project) suite = loader.discover('my_project') runner = TextTestRunner() runner.run(suite) If I run this script, the output is: $ python3 runtest.py .....F..... ====================================================================== FAIL: test_insert (fate.test.test

How to capture the Return Value of a ScriptBlock invoked with Powershell's Invoke-Command

纵然是瞬间 提交于 2019-11-27 11:44:08
问题 My question is very similar to this one, except I'm trying to capture the return code of a ScriptBlock using Invoke-Command (so I can't use the -FilePath option). Here's my code: Invoke-Command -computername $server {\\fileserver\script.cmd $args} -ArgumentList $args exit $LASTEXITCODE The problem is that Invoke-Command doesn't capture the return code of script.cmd, so I have no way of knowing if it failed or not. I need to be able to know if script.cmd failed. I tried using a New-PSSession

ruby system command check exit code

社会主义新天地 提交于 2019-11-27 11:37:24
I have a bunch of system calls in ruby such as the following and I want to check their exit codes simultaneously so that my script exits out if that command fails. system("VBoxManage createvm --name test1") system("ruby test.rb") I want something like system("VBoxManage createvm --name test1", 0) <-- where the second parameter checks the exit code and confirms that that system call was successful, and if not, it'll raise an error or do something of that sort. Is that possible at all? I've tried something along the lines of this and that didn't work either. system("ruby test.rb") system("echo $

Where I can find a list of “mysqldump” exit codes?

孤者浪人 提交于 2019-11-27 09:15:50
I know that exit code = 0 means No error . I got exit code = 2 . What does it means ? Where I can see the complete list of mysqldump exit codes ? Taken from client/mysqldump.c in MySQL 5.1.59: #define EX_USAGE 1 #define EX_MYSQLERR 2 #define EX_CONSCHECK 3 #define EX_EOM 4 #define EX_EOF 5 /* ferror for output file was got */ #define EX_ILLEGAL_TABLE 6 Skimming through the source, EX_MYSQLERR seems to be used mostly for errors from the server, but also in case malloc fails. CONSCHECK seems to stand for consistency checks. EX_EOM is returned for some _alloc calls too - "End Of Memory"?

Why does the program return with an exit code other than I specified?

心不动则不痛 提交于 2019-11-27 07:59:59
问题 This is a simple program : int main() { return 0; } The exit code is 0 . If I write: int main() { return 700; } The exit code is 188 . Why is 188 instead of 700 the exit code here? 回答1: While the main function in C returns an int , operating systems don't necessarily use int as the error code. 700 in binary is 1010111100 . Truncating this value to eight bits yields 10111100 . This equals 188 in decimal. That means your OS uses eight bits for error codes. 1 1 Or possibly nine bits because the

Difference between exit(0) and exit(1) in Python

孤人 提交于 2019-11-27 06:19:47
What's the difference between exit(0) and exit(1) in Python? I tried looking around but didn't find a specific question on these lines. If it's already been answered, a link would be sufficient. 0 and 1 are the exit codes. exit(0) means a clean exit without any errors / problems exit(1) means there was some issue / error / problem and that is why the program is exiting. This is not Python specific and is pretty common. A non-zero exit code is treated as an abnormal exit, and at times, the error code indicates what the problem was. A zero error code means a successful exit. This is useful for

Apple LLVM compiler 3.1 error

点点圈 提交于 2019-11-27 05:58:30
问题 Just updated Xcode to 4.3 and now I can't build my app. I'm getting this error: Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 254 Anybody else having this problem? It's probably just a compilation setting but I'm not sure where to look. Of course, the error includes the entire stack dump, but I've not included that for sake of brevity. I'm hoping that someone will know what "exit code 254" is. Tried searching for it

Why does my Perl script exit with 137?

冷暖自知 提交于 2019-11-27 04:21:12
Is there a way to eliminate a warning (exit code 137) in perl? I am running a Perl script on linux within another shell script. This Perl script exits with a warning and exit code 137. I could not pinpoint what exit code 137 stands for. What is the best way to avoid this warning? I tried "no warnings" in the script and I have an exit 0 at the end of my Perl script as well. 137=128+9, which means some other process has sent you a signal 9, which is SIGKILL. I.e. the other script kills yours, that's what it looks like. I just ran into the same exit code 137 when launching a python script. It

Return value from thread

北城以北 提交于 2019-11-27 03:19:24
How do I get a thread to return a tuple or any value of my choice back to the parent in Python? I suggest you instantiate a Queue.Queue before starting the thread, and pass it as one of the thread's args: before the thread finishes, it .put s the result on the queue it received as an argument. The parent can .get or .get_nowait it at will. Queues are generally the best way to arrange thread synchronization and communication in Python: they're intrinsically thread-safe, message-passing vehicles -- the best way to organize multitasking in general!-) If you were calling join() to wait for the