mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-07 10:56:49 +00:00
startstop_node: use the new find_exe module
This commit is contained in:
parent
5b476d73ee
commit
bba7b81456
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user