Submitter | Yuya Nishihara |
---|---|
Date | Aug. 18, 2016, 10:07 a.m. |
Message ID | <1650ada9f2a157ef12c5.1471514873@mimosa> |
Download | mbox | patch |
Permalink | /patch/16351/ |
State | Accepted |
Headers | show |
Comments
On Thu, Aug 18, 2016 at 07:07:53PM +0900, Yuya Nishihara wrote: > # HG changeset patch > # User Yuya Nishihara <yuya@tcha.org> > # Date 1471513428 -32400 > # Thu Aug 18 18:43:48 2016 +0900 > # Node ID 1650ada9f2a157ef12c5177ae360eb6398244d02 > # Parent 8d226db31f20b8c4a2c119e10be7533948f0bad6 > killdaemons: prevent killing all user processes by bad pid file wow, gpg-connect-agent for the lose. queued. > > When I was fixing the test-gpg issue, I noticed gpg-connect-agent could print > "-1" as a server pid if command was wrong. I'm not pretty sure but nobody > would want to kill their running applications by mistake. > > diff --git a/tests/killdaemons.py b/tests/killdaemons.py > --- a/tests/killdaemons.py > +++ b/tests/killdaemons.py > @@ -82,7 +82,11 @@ def killdaemons(pidfile, tryhard=True, r > for line in fp: > try: > pid = int(line) > + if pid <= 0: > + raise ValueError > except ValueError: > + logfn('# Not killing daemon process %s - invalid pid' > + % line.rstrip()) > continue > kill(pid, logfn, tryhard) > fp.close() > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Patch
diff --git a/tests/killdaemons.py b/tests/killdaemons.py --- a/tests/killdaemons.py +++ b/tests/killdaemons.py @@ -82,7 +82,11 @@ def killdaemons(pidfile, tryhard=True, r for line in fp: try: pid = int(line) + if pid <= 0: + raise ValueError except ValueError: + logfn('# Not killing daemon process %s - invalid pid' + % line.rstrip()) continue kill(pid, logfn, tryhard) fp.close()