Questions tagged [termination]

is used in its general meaning, but it is bounded by the programming scope.

351 questions
1379
votes
14 answers

How do I terminate a script?

How do I exit a script early, like the die() command in PHP?
Teifion
  • 108,121
  • 75
  • 161
  • 195
171
votes
19 answers

How to stop/terminate a python script from running?

I wrote a program in IDLE to tokenize text files and it starts to tokeniza 349 text files! How can I stop it? How can I stop a running Python program?
MACEE
  • 1,923
  • 4
  • 15
  • 10
32
votes
3 answers

What does a semi colon do after a conditional block in C#?

I recently came across this code in a project - which I assume was there by mistake: if(condition) { //Whatever... }; Note the semi colon after the closing brace. Does anyone know what the effect of this is? I assume it does not have any effect,…
Alex
  • 3,730
  • 9
  • 43
  • 94
28
votes
7 answers

How to force stop my android application programmatically?

I'd like to force stop my Android application when I click closeButton. This is my code. protected void onCreate(Bundle savedInstanceState) { this.setContentView(R.layout.layoutxml); this.closeButton = (Button)this.findViewById(R.id.close); …
user573566
  • 509
  • 2
  • 6
  • 9
24
votes
7 answers

Why shouldn't I use Process.GetCurrentProcess().Kill() to exit my WinForm application?

Right now, when the user want to exit my application, I do the few things I have to (ie disconnecting from the server, saving the user data...) and then I do the following : Exit all my mainloops using booleans abort the threads still running…
Brann
  • 31,689
  • 32
  • 113
  • 162
24
votes
3 answers

Pkill -f doesn't work for process killing

I have this process running: 342 pts/2 T 0:00 sh -c sudo screen /usr/bin/python /usr/bin/btdownloadcurses "http://zoink.it/torrent/732A4A9B54B7E3A916C2835D936D985942F65A6D.torrent" --display_interval 20 --saveas "/srv/" 343 pts/2 T 0:00…
Lim zhen xiang
  • 241
  • 1
  • 2
  • 5
22
votes
2 answers

Detect file creation with watchdog

I am trying to detect when a file with a given name is created in a directory. I am doing it thanks to watchdog. The creation is correctly detected but I don't know how to terminate the application properly once the detection is done. My piece of…
Laurent
  • 14,122
  • 13
  • 57
  • 89
21
votes
8 answers

Guaranteed file deletion upon program termination (C/C++)

Win32's CreateFile has FILE_FLAG_DELETE_ON_CLOSE, but I'm on Linux. I want to open a temporary file which will always be deleted upon program termination. I could understand that in the case of a program crash it may not be practical to guarantee…
John Zwinck
  • 239,568
  • 38
  • 324
  • 436
21
votes
7 answers

Assisting Agda's termination checker

Suppose we define a function f : N \to N f 0 = 0 f (s n) = f (n/2) -- this / operator is implemented as floored division. Agda will paint f in salmon because it cannot tell if n/2 is smaller than n. I don't know how to tell Agda's termination…
Jonathan Gallagher
  • 2,115
  • 2
  • 17
  • 31
20
votes
2 answers

How to know whether app is terminated by user or iOS (after 10min background)

How to know whether app is terminated by user or by iOS when restart app> 'By user' means "by Double-clicking Home Button and pressing - button". killed by user 'By iOS' means "app become background running state, and iOS terminate app after 10…
ChangUZ
  • 5,380
  • 10
  • 46
  • 64
17
votes
5 answers

How terminate child processes when parent process terminated in C#

Task: Auto kill all child processes if parent process terminate. Parent procees can be terminated not only in correct way, but also by killing in ProcessExplorer, for example. How can I do it? Similar question in С topic advice to use Job objects.…
LionSoft
  • 1,469
  • 2
  • 15
  • 20
14
votes
1 answer

C++ TerminateProcess function

I've been searching examples for the Win32 API C++ function TerminateProcess() but couldn't find any. I'm not that familiar with the Win32 API in general and so I wanted to ask if someone here who is better in it than me could show me an example…
jemper
  • 177
  • 1
  • 1
  • 4
13
votes
4 answers

EC2 volume: how do I set it so that it WILL delete on termination?

I have an EC2 instance that I'd like to take a snapshot of, to use as an AMI for future spot instances. Because of the way I created volume for this instance, it is currently set to not delete upon termination. I want it to delete on termination, so…
Dan
  • 651
  • 2
  • 8
  • 19
13
votes
1 answer

Kubernetes Nginx: How to have zero-downtime deployments?

I am attempting to have a kubernetes nginx deployment with zero downtime. Part of that process has been to initiate a rollingUpdate, which ensures that at least one pod is running nginx at all times. This works perfectly well. I am running into…
Lindsay Landry
  • 4,657
  • 1
  • 15
  • 19
11
votes
2 answers

Bash: How do I make sub-processes of a script be terminated, when the script is terminated?

The question applies to a script such as the following: Script #!/bin/sh SRC="/tmp/my-server-logs" echo "STARTING GREP JOBS..." for f in `find ${SRC} -name '*log*2011*' | sort --reverse` do ( OUT=`nice grep -ci -E "${1}" "${f}"` …
Ivivi Vavava
  • 723
  • 1
  • 8
  • 11
1
2 3
23 24