exit

Catching exception on environment.exit

Hi, I need to return an exit code of 1 after my Main functions ends. However I have an other thread that never ends (while(true)). So I managed to call Environment.Exit(1). But I got some exception when diposing com objects... For several reasons I can't change the other thread code. What do you guys advocate to do ? May I catch the e...

Diagnosing an app that fails to halt

Our Windows app is often hanging in memory and I'm trying to use windbg to track down the problem. I'm very new to windbg and could use some advice (I have started to read Advanced Windows Debugging though). The app is a mix of C++ and COM objects written in VB. Occasionally when you exit, the app appears to go away but task manager sho...

Application.Exit

Hello everyone, I am using VSTS 2008 + .Net 3.5 + C# to develop Windows Forms application. My confusion is, seems Application.Exit does not force application to terminate? If not, which method should I call to make application terminate? EDIT 1: Normally the main method is like this, how to exit Main function gracefully without callin...

VS2008 unit tests - assert method exits

I'm trying to write a C# unit test with VS 2008's built-in unit testing framework and the method I'm testing calls Environment.Exit(0). When I call this method in my unit test, my unit test is Aborted. The method should indeed be calling Exit, and I want a way to test that it does, and also to test the exit code that it uses. How migh...

cygwin / vista32 bash.exe has stopped working

Our work machines are moving to vista so I am struggling through installing cygwin. After setting the proxy on the installer manually instead of using "use IE5 settings" and running the following command: mkpasswd -l -c > /etc/passwd; mkgroup -l -d > /etc/group I finally have a "working" version of cygwin. However, when I type exi...

How to end / Force a close to a program (in Clojure)

Hi, I am a pretty decent programmer in Java, however I am new to programming in Clojure. My question is : In java, to force an exit in the program, the code is :System.exit(0) ..........Is there any equivalent to this code is Clojure? -Thank you ...

ruby at_exit exit status

Can i determine selves process exit status in at_exit block? at_exit do if this_process_status.success? print 'Success' else print 'Failure' end end ...

Batch file I wrote will not close automatically or on EXIT

I made this batch file to close explorer before launching Worms because for some reason my colors get messed up if I don't. The batch file works fine except that it doesn't close when it's finished. What did I do wrong? @echo off echo Closing explorer and launching worms taskkill /F /IM explorer.exe "C:\Games\Worms Armageddon - New Edit...

exit failed script run (python)

I have seen several questions about exiting a script after a task is successfully completed, but is there a way to do the same for a script which has failed? I am writing a testing script which just checks that a camera is functioning correctly. If the first test fails it is more than likely that the following tests will also fail; there...

How to exit from python without traceback?

I would like to know how to I exit from python without having an traceback dump on the output. I still want want to be able to return an error code but I do not want to display the traceback log. I want to be able to exit using exit(number) without trace but in case of an Exception (not an exit) I want the trace. ...

C# Container Question

Hi, I'm having a weird problem with adding stuff to my Container. Whenever I try to add the items it simply exits the while loop, even though isServer is still 1. I've tried to make a custom function, same result. Then i tried calling the Add(..) function directly and still same result. I don't see how inserting items to my container is...

Python: Why does `sys.exit(msg)` called from a thread not print `msg` to stderr?

Hello! Today I ran against the fact, that sys.exit() called from a child-thread does not kill the main process. I did not know this before, and this is okay, but I needed long time to realize this. It would have saved much much time, if sys.exit(msg) would have printed msg to stderr. But it did not. It turned out that it wasn't a real ...

How do I gracefully exit WinForms app when hitting stop debugging in VS?

I'm writing a system tray Winforms app which does some very important cleanup on Application.ApplicationExit. When I hit the stop button while debugging in Visual Studio, this the process exits, but this cleanup code doesn't get called. Is there some way I can make sure it gets called in this situation? ...

Application.Exit() vs Application.ExitThread() vs Environment.Exit()

I am trying to figure out which I should be using. On closing my WinForm App fires of a Form in Dialog mode. That form runs a Background worker that Syncs the DB with the remote DB and displays it's progress on the "Splash Form." I have a method like so --> private void CloseMyApp() { SaveUserSettings(); ...

Motif: Intercept close box event and prevent application exit? (C++)

How do I intercept when the user clicks on a motif window's (widget's) close box, and how do I prevent the Motif window manager to close the entire calling application on the close box being clicked (so that my app can close the Motif application context and windows and continue to run)? I've tried to find out myself with Google, tuts an...

Prompt on exit in PyQt application

Hi. Is there any way to promt user to exit the gui-program written in Python? Something like "Are you sure you want to exit the program?" I'm using PyQt. ...

How to catch exit() in embedded C++ module from python code ?

Hello, I am embedding a c++ library (binding done with SIP) in my python application. Under certain circonstances (error cases), this library uses exit(), which causes my entire application to exit. Is there a way to catch this event, or do I need to modify the library to handle error cases differently ? Thank you very much, ...

Windows Mobile 5 - Handle Application Exit

Hi there, I'm developing for Windows Mobile 5.0 and have come across a little issue with my app. I'm using the win32 api to schedule a process to run periodically. This is thanks to the code posted at http://www.codeproject.com/KB/mobile/WiMoPower1.aspx (call to CeRunAppAtTime) The problem I've got however is that if I'm scheduling a p...

Xbap application: How can I prompt user to confirm exit when the user close the browser or browser tab?

application_exit and session_ending event in app.xaml cannot help. Is there any way to achieve this? ...

c# windows mobile standard - Back button won't close the app

The background of the app is still there when i push the back button. Does anyone know what i can do, to prevent this? If i use Application.Exit(), it works. thanks in advance love stackoverflow :) ...