exit

PHP: multiple commands in die/exit

when it gives a error I want him to do 2 things. echo nl2br($qVraagOp); mysql_error(); so i thougth: $rVraagOp = mysql_query( $qVraagOp ) or die( echo nl2br($qVraagOp); mysql_error(); ); I can write a function that does these two things and then call that but that a bit redundant. is there a other way? Matthy ...

Any exit status without explicitly using return /exit

This actually bugging me from quite sometime now.The question is like this : How to set the the exit status of a program to any value without explicitly using return/exit in gcc/g++ ? Let us consider this piece of code : (Takes input from stdin and print it to the stdout until a zero input 0 is encountered) #include <stdio.h> int main(...

Run top, print output, then quit OR how to get real memory usage without top

I'm running Mac OS 10.6. I want to run top to get memory usage, but not in interactive mode, or any mode that updates. I just want memory usage at that point in time then return to prompt. I've looked for other utilities to get memory usage... but came up short (vm_stat is for virtual memory). Can someone direct me how to get top or some...

android pressing back button should exit the app

on intent when user press back button should exit from the application, how can i track back button and exit from the app ? ...

How do I properly close a winforms application in C#?

I ran the .exe for my program from the debug folder. It worked, but when I closed it, I discovered that it was still listed on the processes list in the Task Manager. I figure I must've forgotten a step, since it's my first winforms program. ...

What might cause ruby to lock up while exiting?

I have a ruby script that does a few perforce operations (through the scripting API) then simply ends: def foo() ... end def bar() ... end foo() bar() puts __LINE__ exit 0 #end of file ...and while the LINE will print out, the process never ends, whether the exit(0) is there or not. This is ruby 1.8.6, primarily on the mac, but...

OnExit Event For a Swing Application?

I'm developing a simple application to manage the operational part of a business using Swing, but I need that when the application exits, it performs this: updateZonas(); db.close(); But how can I do this? ...

wpf exit thread automatically when application closes

Hi, I have a main wpf window and one of its controls is a user control that I have created. this user control is an analog clock and contains a thread that update hour, minute and second hands. Initially it wasn't a thread, it was a timer event that updated the hour, minutes and seconds but I have changed it to a thread because the appli...

How to exit a bash loop using ls?

I want to loop over a series of files in a directory in batches and then exit when the directory is empty. At $work 'myprog' is actually a program which processes (and archives) incoming email in a Maildir in batches of 100. I am after something simple I can put into cron. #!/bin/bash # Setup mkdir -p foo && touch foo/file_{1,2,3,4}....

C#/.NET: Process.HasExited returns true even though process is running??

I have been observing that Process.HasExited sometimes returns true even though the process is still running. My code below starts a process with name "testprogram.exe" and then waits for it to exit. The problem is that sometimes I get thrown the exception; it seems that even though HasExited returns TRUE the process itself is still ali...

wpf cancel backgroundworker on application exits

Hi! In my application I have a main windows and into it, in a frame I load a page. This page do a long time task when the user press a button. My problem is that when long task is being doing and the user presses the close button of the main window, the application seems to not finish because I am debugging it in VS2008 and I can see th...

JUnit - stop it from exiting on finish?

Hi guys, Quick JUnit question. I'm running some unit tests that involve starting up the GUI and doing a load of stuff. I would like to see the results after the test to confirm it visually. However, it gets to the end of the code and exits, as it should. If I want to override this, I put a breakpoint on the last line of the test. This ...

How to run code before program exit?

Hi all, I have a little console C# program like Class Program { static void main(string args[]) { } } Now I want to do something after main() exit. I tried to write a deconstructor for Class Program, but it never get hit. Does anybody know how to do it. Thanks a lot ...

C# What is the sense of Application.Exit Method ?

I'm asking this question, because I can't figure out when I could find an use of this method. If I've designed everything correctly then I should be able by the medium of normal returns and try catch clauses to handle all problems and end the application in a correct manner. Am I wrong ? ...

content not dying

I have a function, where if a variable is not defined, exit; is called, therefor it should not produce anything on the page but a blank page. it produces an error message right before it is exited actually. so when its supposed to execute, because the variable is not defined, it should die, but what happens is the error message is execut...

Python subprocess: callback when cmd exits

Hi, I'm currently launching a programme using subprocess.Popen(cmd, shell=TRUE) I'm fairly new to Python, but it 'feels' like there ought to be some api that lets me do something similar to: subprocess.Popen(cmd, shell=TRUE, postexec_fn=function_to_call_on_exit) I am doing this so that function_to_call_on_exit can do something base...

Exit to command line in Python

I have a script that I want to exit early under some condition: if not "id" in dir(): print "id not set, cannot continue" # exit here! # otherwise continue with the rest of the script... print "alright..." [ more code ] I run this script using execfile("foo.py") from the Python interactive prompt and I would like the script ...

SH/BASH - Scan a log file until some text occurs, then exit. How??

Edit - Reworded the question a bit on April 7th to make it clearer. Current working environment is OSX 10.4.11. I want to scan a log file for a certain phrase. The log file can NOT be emptied at the start of the script. Thus, the script must scan only changes to the log. My current script: #!/bin/sh tail -f log.txt | while read lin...

What can cause Java to keep running after System.exit()?

I have a Java program which is being started via ProcessBuilder from another Java program. System.exit(0) is called from the child program, but for some of our users (on Windows) the java.exe process associated with the child doesn't terminate. The child program has no shutdown hooks, nor does it have a SecurityManager which might stop ...

Will exit() or an exception prevent an end-of-scope destructor from being called?

Let's say I have the following code: struct mytype { ~mytype() { /* do something like call Mix_CloseAudio etc */ } }; int main() { mytype instant; init_stuff(); start(); return 0; } Is that destructor guaranteed to be called even if exit() is used from somewhere inside start() ? ...