exit

simple IPython example raises exception on sys.exit()

倖福魔咒の 提交于 2019-11-27 14:25:34
I'm doing some very simple PySide (and PyQt) tutorials in IPython. One tutorial just creates a window with some sliders to demonstrate slots and signals. When I close the window of the running demo application, I see this error: An exception has occurred, use %tb to see the full traceback. SystemExit: 0 To exit: use 'exit', 'quit', or Ctrl-D. So I run %tb and get this: SystemExit Traceback (most recent call last) /Workspaces/scratch/<ipython-input-1-88966dcfb499> in <module>() 33 34 if __name__ == "__main__": ---> 35 main() /Workspaces/scratch/<ipython-input-1-88966dcfb499> in main() 29 w.show

Exit batch script from inside a function

落爺英雄遲暮 提交于 2019-11-27 12:27:34
I have a problem with my batch file. It builds several programs automatically by doing something like this: set some compilation flags run 'gmake all' call the "check error level" function and if errorlevel 1, exit So it looks like this: set FLAG=1 ... gmake all call :interactive_check set OTHERFLAG=1 ... gmake all call :interactive_check There's 6 or 7 of these (and it might grow). So I made a function to check errorlevel instead of copy/pasting it at every step. The problem is this: the error checking is made through a function: :interactive_check if errorlevel 1 ( echo. echo /!\/!\/!\/!\/!\

Gracefully Exit Explorer (Programmatically)

断了今生、忘了曾经 提交于 2019-11-27 12:03:20
How do you gracefully close Explorer programmatically? By that I mean, how do you invoke this function programmatically: Edit: Typo in the picture, it should say "Ctrl-Shift-Right-Click" instead of "Shift-Click". I debugged this out of curiosity. All it does is post a message to one of explorer's windows: BOOL ExitExplorer() { HWND hWndTray = FindWindow(_T("Shell_TrayWnd"), NULL); return PostMessage(hWndTray, 0x5B4, 0, 0); } Of course this is an undocumented WM_USER message so the behavior could quite possibly change in the future. @Luke: first of all, thanks for the detailed analysis and the

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 $

Under what circumstances are C++ destructors not going to be called?

筅森魡賤 提交于 2019-11-27 10:52:08
I know that my destructors are called on normal unwind of stack and when exceptions are thrown, but not when exit() is called. Are there any other cases where my destructors are not going to get called? What about signals such as SIGINT or SIGSEGV? I presume that for SIGSEGV, they are not called, but for SIGNINT they are, how do I know which signals will unwind the stack? Are there any other circumstances where they will not be called? stinky472 Are there any other circumstances where they[destructors] will not be called? Long jumps: these interfere with the natural stack unwinding process and

How do I abort the execution of a Python script? [duplicate]

孤者浪人 提交于 2019-11-27 10:45:56
Possible Duplicate: Terminating a Python script I have a simple Python script that I want to stop executing if a condition is met. For example: done = True if done: # quit/stop/exit else: # do other stuff Essentially, I am looking for something that behaves equivalently to the 'return' keyword in the body of a function which allows the flow of the code to exit the function and not execute the remaining code. ryan_s To exit a script you can use, import sys sys.exit() You can also provide an exit status value, usually an integer. import sys sys.exit(0) Exits with zero, which is generally

Disabling C++ exceptions, how can I make any std:: throw() immediately terminate?

自作多情 提交于 2019-11-27 09:59:57
问题 This C++ program is a CGI script, I have no desire to deal with exceptions. I'd rather get a marginal performance boost and let the OS (Linux) handle cleanup after the process dies. I am using the Standard C++ Library, and want any function to die like in Perl: Whenever it throws an exception. Without unwinding, or running any further code in my process. How does -fno-exceptions work? If I have no catch at all in my code, and basically pretend like exceptions do no exist. but I do use std:: c

exit application when click button - iOS [duplicate]

浪尽此生 提交于 2019-11-27 09:12:02
Possible Duplicate: Exit application in iOS 4.0 I have a AlertView which displays some text and an "OK" button. Is there any way to exit application when clicked on OK button? exit(X) , where X is a number (according to the doc) should work. But it is not recommended by Apple and won't be accepted by the AppStore. Why? Because of these guidelines (one of my app got rejected): We found that your app includes a UI control for quitting the app. This is not in compliance with the iOS Human Interface Guidelines, as required by the App Store Review Guidelines. Please refer to the attached screenshot

Why does returning from _start segfault?

流过昼夜 提交于 2019-11-27 08:47:36
问题 I tried to put code not in the main function, but directly into _start : segment .text global _start _start: push rbp mov rbp, rsp ; ... program logic ... leave ret Compile: yasm -f elf64 main.s ld -o main main.o Run: ./main Segmentation fault(core dumped) I read, leave is mov esp,ebp pop ebp But why is it that such an epilogue to the pop stack frame and the set base frame pointer to a previous frame's base results in a segmentation fault? Indeed, making an exit system call exits gracefully.

How do you return to a sourced bash script?

筅森魡賤 提交于 2019-11-27 08:33:23
I use a script that extends using the bash source feature; #!/bin/bash source someneatscriptthatendsprematurely.sh I would like to be able to return from that script, without breaking the main script. Using exit breaks the main script, return is only valid in functions and experimenting with $(exit 1) does not seem to work either. So, is it possible to return in a sub-bash script without breaking the main bash? Any help appreciated! You need the return statement: return [n] Causes a function to exit with the return value specified by n . If n is omitted, the return status is that of the last