Exiting, quitting, or halting refers to the termination of a process or program.
Questions tagged [exit]
2585 questions
48
votes
12 answers
How to exit when back button is pressed?
When a user presses the back button on an intent, the application should quit. How can I ensure the application quits when the back button is pressed?

d-man
- 57,473
- 85
- 212
- 296
46
votes
4 answers
How to cancel shutdown on Linux?
I'm familiar with and use shutdown in Linux, and typically just do
> shutdown -h now
But is there a way to stop shutdown from happening, say if I aim to shutdown 10 minutes from now and then in 5 minutes' time I discover I really don't want to shut…

David
- 17,673
- 10
- 68
- 97
46
votes
17 answers
Android emulator won't shut down
The emulator starts up fine. But when you long-press the power button (or F7) and choose "Power off", it displays a "Shutting down" message which remains on-screen forever and the emulator won't actually shut down.
I can close the emulator window or…

Cyker
- 9,946
- 8
- 65
- 93
45
votes
6 answers
exit function stack without exiting shell
I was writing a script and then came across a odd problem. If I'd source a script that contains a bunch of functions that may call an error function which outputs a string and then exits, it will exit my shell. I know why it does it. It is…

Adrian
- 10,246
- 4
- 44
- 110
43
votes
1 answer
What is the difference between exit and abort?
The abort documentation says abort will
Terminate execution immediately, effectively by calling Kernel.exit(false).
What exactly does "immediately" mean? What is the difference between abort and exit with non-true status?

x-yuri
- 16,722
- 15
- 114
- 161
41
votes
2 answers
How do __enter__ and __exit__ work in Python decorator classes?
I'm trying to create a decorator class that counts how many times a function is called, but I'm getting an error message that says:
"TypeError: __exit__() takes exactly 1 argument (4 given)"
and I really don't know how I'm giving it four…

user3402743
- 553
- 2
- 8
- 12
41
votes
3 answers
How to stop execution of a node.js script?
Say I've got this script:
var thisIsTrue = false;
exports.test = function(request,response){
if(thisIsTrue){
response.send('All is good!');
}else{
response.send('ERROR! ERROR!');
// Stop script execution here.
…

AJB
- 7,389
- 14
- 57
- 88
39
votes
6 answers
Exiting Python Debugger ipdb
I use ipdb fairly often in a way to just jump to a piece of code that is isolated i.e. it is hard to write a real script that uses it. Instead I write a minimal test case with mocking and jump into it.
Exemplary for the workflow:
def func():
...
…

Joachim
- 3,210
- 4
- 28
- 43
39
votes
13 answers
Android: Quit application when press back button
In my application i want exit from app when press back button, this my code:
@Override
public void onBackPressed() {
new AlertDialog.Builder(this).setIcon(android.R.drawable.ic_dialog_alert).setTitle("Exit")
…

Elham Gdz
- 1,015
- 3
- 15
- 31
38
votes
6 answers
Return an exit code without closing shell
I'd like to return an exit code from a BASH script that is called within another script, but could also be called directly. It roughly looks like this:
#!/bin/bash
dq2-get $1
if [ $? -ne 0 ]; then
echo "ERROR: ..."
# EXIT HERE
fi
# extract, do…

fuenfundachtzig
- 7,952
- 13
- 62
- 87
38
votes
11 answers
How to exit the REPL
I'm trying to exit the REPL.
I use (. System exit 0) or (System/exit 0), but that causes an error:
Exception in thread "Thread-3" java.lang.RuntimeException: java.lang.IndexOutOfBoundsException
Is there another way to exit the REPL? How I can…

patz
- 767
- 2
- 7
- 13
37
votes
2 answers
Are destructors run when calling exit()?
Possible Duplicate:
Will exit() or an exception prevent an end-of-scope destructor from being called?
In C++, when the application calls exit(3) are the destructors on the stack supposed to be run to unwind the stack?

WilliamKF
- 41,123
- 68
- 193
- 295
37
votes
2 answers
How do you cleanly exit interactive Lua?
I've tried to the word "quit" on a single line but this seems to simply change the command line pointer from a ">" to a ">>". What's the best way to end a session in interactive Lua please?

James Bedford
- 28,702
- 8
- 57
- 64
37
votes
6 answers
Difference between return 1, return 0, return -1 and exit?
For example consider following code:
int main(int argc,char *argv[])
{
int *p,*q;
p = (int *)malloc(sizeof(int)*10);
q = (int *)malloc(sizeof(int)*10);
if (p == 0)
{
printf("ERROR: Out of memory\n");
return 1;
}
…
user3138495
37
votes
2 answers
exit application when click button - iOS
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?

AVINASH KANNA
- 617
- 1
- 5
- 11