Improved forced shutdown on Unix and Windows. Unix uses SIGKILL now, Windows os.abort().

git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@3852 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
calvin 2008-07-28 16:56:02 +00:00
parent bb8bca1b70
commit 0cade7b308
2 changed files with 19 additions and 2 deletions

View file

@ -67,6 +67,10 @@
Changed: linkcheck/cookies.py
Closes: SF bug #2016451
* Improved double Ctrl-C abort on Unix and Windows platforms.
Type: feature
Changed: linkcheck/director/__init__.py
4.9 "Michael Clayton" (released 25.4.2008)
* Parse Shockwave Flash (SWF) for URLs to check

View file

@ -100,8 +100,21 @@ def abort (aggregate):
break
except KeyboardInterrupt:
log.warn(LOG_CHECK, _("keyboard interrupt; force shutdown"))
# forced exit without cleanup
os._exit(1)
abort_now()
def abort_now ():
"""Force exit of current process without cleanup."""
if os.name == 'posix':
# Unix systems can use sigkill
import signal
os.kill(os.getpid(), signal.SIGKILL)
elif os.name == 'nt':
# NT as os.abort()
os.abort()
else:
# All other systems have os._exit() as best shot.
os._exit(3)
def get_aggregate (config):