From bba7b81456a0f3efc5a3c34dabf34678e4bc56d5 Mon Sep 17 00:00:00 2001 From: Zooko O'Whielacronx Date: Mon, 15 Oct 2007 10:25:15 -0700 Subject: [PATCH] startstop_node: use the new find_exe module --- src/allmydata/scripts/startstop_node.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/allmydata/scripts/startstop_node.py b/src/allmydata/scripts/startstop_node.py index f8de7924..cba7038a 100644 --- a/src/allmydata/scripts/startstop_node.py +++ b/src/allmydata/scripts/startstop_node.py @@ -2,8 +2,7 @@ import os, sys, signal, time from twisted.python import usage from allmydata.scripts.common import BasedirMixin -from allmydata.util import fileutil -from twisted.python.procutils import which +from allmydata.util import fileutil, find_exe class StartOptions(BasedirMixin, usage.Options): optParameters = [ @@ -48,19 +47,12 @@ def do_start(basedir, profile=False, out=sys.stdout, err=sys.stderr): if not os.path.isdir(basedir): print >>err, " in fact, it doesn't look like a directory at all!" return 1 - twistds = which("twistd") - twistd = twistds and twistds[0] - if not twistd: - twistd = os.path.join(sys.prefix, 'Scripts', 'twistd.py') - if not os.path.exists(twistd): + + cmd = find_exe.find_exe('twistd') + if not cmd: print "Can't find twistd (it comes with Twisted). Aborting." sys.exit(1) - path, ext = os.path.splitext(twistd) - if ext.lower() in [".exe", ".bat",]: - cmd = [twistd,] - else: - cmd = [sys.executable, twistd,] - + fileutil.make_dirs(os.path.join(basedir, "logs")) cmd.extend(["-y", tac, "--logfile", os.path.join("logs", "twistd.log")]) if profile: -- 2.45.2