exit

'Break' equivalent keyword for VB

Just moved over to the VB team here at work. Quick easy one for my 1st question. What is the equivalent keyword to break in VB, i.e., to exit a loop early but not the method? Cheers! ...

Is there a way to prevent a SystemExit exception raised from sys.exit() from being caught?

The docs say that calling sys.exit() raises a SystemExit exception which can be caught in outer levels. I have a situation in which I want to definitively and unquestionably exit from inside a test case, however the unittest module catches SystemExit and prevents the exit. This is normally great, but the specific situation I am trying ...

How do I abort the execution of a Python script?

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 func...

How do I guarantee fast shutdown of my win32 app?

I've got a c++ Win32 app that has a number of threads that might be busy doing IO (HTTP calls, etc) when the user wants to shutdown the app. Currently, I play nicely and wait for all the threads to end before returning from main. Sometimes, this takes longer than I would like and indeed, it seems kind of pointless to make the user wait...

S60 application - Symbian C++ - Exit button doesn't work

Hi In my Symbian S60 application, my Options menu works as expected. But the Exit button does nothing. I am developing with Carbide and have used the UI Designer to add items to the options menu. Does anyone know how to enable the exit button, or why else it might not work? Thanks! ...

What is the difference between exit() and abort()?

In C and C++, what is the difference between exit() and abort()? I am trying to end my program after an error (not an exception). ...

WPF Command Line

I am trying to create a WPF application that takes command line arguments. If no arguments are given, the main window should pop up. In cases of some specific command line arguments, code should be run with no GUI and exit when finished. Any suggestions on how this should properly be done would be appreciated. ...

Android: Capturing the return of an activity.

I have a question regarding launching new activities. It boils down to this. I have 3 tabs on a view A) contains gMap activity B) camera activity C) some random text fields. Requirement is that the application runs in Portrait mode. All 3 tabs work as expected w/ the exception of the Camera Preview Surface (B). It is rotated 90 deg...

Capture console exit C#

I have a console application that contains quite a lot of threads. There are threads that monitor certain conditions and terminate the program if they are true. This termination can happen at any time. I need an event that can be triggered when the program is closing so that I can cleanup all of the other threads and close all file ha...

Does Application.ApplicationExit event work to be notified of exit in non-Winforms apps?

Our code library needs to be notified when the application is exiting. So we have subscribed to the System.Window.Forms.Application.ApplicationExit event. This works nicely for Winforms apps, but does it also work for other types of applications such as console apps, services, and web apps (such as ASP.NET)? The namespace would suggest...

How to use SetConsoleHandler() to block exit calls

Ok so i know that i have to use setconsolehandler() if i want to manage console closing events. So i have a little of an understanding, but i don't know how to block the CTRL_CLOSE_EVENT, ive tried returning false/true if it catches that event, but no success Here is what i have so far (thank you Anton Gogolev!) [DllImport("Kernel32...

java swing close window without exiting app

I have a little frame where I ask user & password. This frame will be opened clicking over a button in a main window. Then I have two buttons: ok and cancel. When I click on "cancel" button, I need to close this frame without exiting the app. How can I do that? ...

Catching exit(1);

I have a MFC SDI application which during startup loads a DLL. I am only able to view the source code and use the DLL but not changing & recompiling it. The situation now is that, whenever the DLL encouner an error it will call exit() such as below. bool Func() { // .. do something here if (error) { exit(999); } } In my MFC appl...

Why doesn't Perl print the last text before it exits?

My code won't run the last line right before " exit; " and I have no clue why. I tried to put an additional printf $fh line before exit, but that didn't work either; it would not print either line. Everything else prints fine except the last print statements before the exit. Any clue why this happens? Or better yet, how to fix or wor...

SQL Server - stop or break execution of a SQL script

Is there a way to immeidately stop execution of a SQL script in SQL server, like a "break" or "exit" command? I have a script that does some validation and lookups before it starts doing inserts, and I want it to stop if any of the validations or lookups fail. ...

About the exit() function in C++

The getche() function doesn't terminate the program properly, so I want to try exit(int status) function. How does it work in Turbo C++ programming language? I cannot understand the explanation in related help modules and I seek for a better explanation... E.g. what does function's parameter consist of? Thanks in advance! ...

Any benefit in using WEXITSTATUS macro in C over division by 256 on exit() status?

I was doing an exercise for university where I had to return a value with exit, that value was actually a count of something. This could be above 255 (which exit() can't handle) but the teacher suggested to use test data where the count could never go above that value. After all this, I needed to handle this count value, the exit status...

How can I restore process state after a crash?

What's a good way to persist state when restarting a crashed process? I have a supervisor in an OTP application what watches several "subsystem" gen_servers. For example, one is a "weather" subsystem that generates a new weather state every 15 minutes and handles queries for the current state of the weather. (Think the lemonade stand ...

How to exit a child process and return its status from execvp()?

In my simple custom shell I'm reading commands from the standard input and execute them with execvp(). Before this, I create a fork of the current process and I call the execvp() in that child process, right after that, I call exit(0). Something like this: pid = fork(); if(pid == -1) { perror("fork"); exit(1); } if(pid == 0) ...

How do I add code to the exit button in a c# form?

I'm using Microsoft Visual C# 2008 Express. In my main form, there's that X button to close the form at the top right. How do I add code to this button? In my menu, I have an "Exit" item and it has code that cleans up and closes my databases. How do I add the same code to this button if the user chooses that as a way to exit? Thanks...