From: wilcoxjg Date: Thu, 9 Aug 2007 15:57:45 +0000 (-0700) Subject: If do_stop attempts to stop a nonexistent process the OSError exception is caught... X-Git-Tag: allmydata-tahoe-0.5.0~95 X-Git-Url: https://git.rkrishnan.org/frontends/wapi.txt?a=commitdiff_plain;h=e13783cd6af15cbf5331978a5d921308ecf4f00d;p=tahoe-lafs%2Ftahoe-lafs.git If do_stop attempts to stop a nonexistent process the OSError exception is caught (by errno) and handled tersely. --- diff --git a/src/allmydata/scripts/startstop_node.py b/src/allmydata/scripts/startstop_node.py index 557578e5..d688cf29 100644 --- a/src/allmydata/scripts/startstop_node.py +++ b/src/allmydata/scripts/startstop_node.py @@ -91,7 +91,14 @@ def do_stop(basedir, config, out=sys.stdout, err=sys.stderr): pid = int(pid) timer = 0 - os.kill(pid, signal.SIGTERM) + try: + os.kill(pid, signal.SIGTERM) + except OSError, oserr: + if oserr.errno == 3: + print oserr.strerror + return 1 + else: + raise time.sleep(0.1) while timer < 5: # poll once per second until twistd.pid goes away, up to 5 seconds