diff options
author | pav <pav@FreeBSD.org> | 2009-10-26 22:33:49 +0800 |
---|---|---|
committer | pav <pav@FreeBSD.org> | 2009-10-26 22:33:49 +0800 |
commit | dcc2eb5f81dd974f5f967b7ee592393e1d34c432 (patch) | |
tree | 7972159f393919457deedc3fe6212c78fa8ae762 /deskutils | |
parent | 5e92d94a1aabacdd21d9fae8cf7a4f436f93dbf0 (diff) | |
download | freebsd-ports-gnome-dcc2eb5f81dd974f5f967b7ee592393e1d34c432.tar.gz freebsd-ports-gnome-dcc2eb5f81dd974f5f967b7ee592393e1d34c432.tar.zst freebsd-ports-gnome-dcc2eb5f81dd974f5f967b7ee592393e1d34c432.zip |
- Fix code that does already-running check
PR: ports/139827
Submitted by: Ruslan Mahmatkhanov <cvs-src@yandex.ru> (maintainer)
Diffstat (limited to 'deskutils')
-rw-r--r-- | deskutils/gtg/Makefile | 2 | ||||
-rw-r--r-- | deskutils/gtg/files/patch-GTG_gtg.py | 40 |
2 files changed, 41 insertions, 1 deletions
diff --git a/deskutils/gtg/Makefile b/deskutils/gtg/Makefile index 5ca47035c19d..ce2408a179dc 100644 --- a/deskutils/gtg/Makefile +++ b/deskutils/gtg/Makefile @@ -7,7 +7,7 @@ PORTNAME= gtg PORTVERSION= 0.1.2 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= deskutils gnome python MASTER_SITES= http://launchpad.net/gtg/trunk/${PORTVERSION}/+download/ diff --git a/deskutils/gtg/files/patch-GTG_gtg.py b/deskutils/gtg/files/patch-GTG_gtg.py new file mode 100644 index 000000000000..1aa0e1a909a6 --- /dev/null +++ b/deskutils/gtg/files/patch-GTG_gtg.py @@ -0,0 +1,40 @@ +--- GTG/gtg.py.orig 2009-07-04 16:26:24.000000000 +0400 ++++ GTG/gtg.py 2009-09-16 19:43:28.000000000 +0400 +@@ -58,28 +58,24 @@ + #we allow one instance of gtg by data directory. + def check_instance(directory): + """ Check if gtg is already running. """ +- pidfile = directory + "gtg.pid" ++ pidfile = os.path.join(directory, "gtg.pid") + if not os.path.exists(pidfile): +- f = open(pidfile, "w") +- f.close() +- os.chmod(pidfile, 0600) ++ open(pidfile, "w").close() ++ os.chmod(pidfile, 0600) + + #see if gtg is already running +- f = open(pidfile, "r") +- pid = f.readline() +- f.close() ++ pid = open(pidfile, "r").readline() + if pid: +- p = os.system("ps --no-heading --pid " + pid) +- p_name = os.popen("ps -f --pid " + pid).read() ++ p = os.system("/bin/ps %s >/dev/null" % pid) ++ p_name = os.popen("/bin/ps -f %s" % pid).read() + if p == 0 and "gtg" in p_name: + print _("gtg is already running!") + #todo : expose the browser (will be possible when we have dbus) + sys.exit(0) +- ++ + #write the pid file +- f = open(pidfile, "w") +- f.write(str(os.getpid())) +- f.close() ++ with open(pidfile, "w") as f: ++ f.write(`os.getpid()`) + + #=== MAIN CLASS ================================================================ + |