From 28b2c19f1e990734f50e87c826ab665150c66835 Mon Sep 17 00:00:00 2001
From: Zooko O'Whielacronx <zooko@zooko.com>
Date: Fri, 21 Sep 2007 14:45:20 -0700
Subject: [PATCH] startstop_node.py: find twistd.py in sys.prefix/scripts if
 there isn't a twistd executable on the path

---
 src/allmydata/scripts/startstop_node.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/allmydata/scripts/startstop_node.py b/src/allmydata/scripts/startstop_node.py
index 0b7306f2..96df1f71 100644
--- a/src/allmydata/scripts/startstop_node.py
+++ b/src/allmydata/scripts/startstop_node.py
@@ -39,10 +39,12 @@ def do_start(basedir, config, out=sys.stdout, err=sys.stderr):
             print >>err, " in fact, it doesn't look like a directory at all!"
         return 1
     twistds = which("twistd")
-    if not twistds:
+    twistd = twistds and twistds[0]
+    if not twistd:
+        twistd = os.path.join(sys.prefix, 'Scripts', 'twistd.py') 
+    if not os.path.exists(twistd):
         print "Can't find twistd (it comes with Twisted).  Aborting."
         sys.exit(1)
-    twistd = twistds[0]
     path, ext = os.path.splitext(twistd)
     if ext.lower() in [".exe", ".bat",]:
         cmd = [twistd,]
-- 
2.45.2