From: david-sarah Date: Sat, 27 Nov 2010 23:26:50 +0000 (-0800) Subject: bin/tahoe-script.template: On non-Windows, invoke support/bin/tahoe directly as a... X-Git-Tag: allmydata-tahoe-1.8.2b1~84 X-Git-Url: https://git.rkrishnan.org/pf/content/en/service/module-simplejson.html?a=commitdiff_plain;h=9815852a095827769d04afd0aab196f79d07e8cb;p=tahoe-lafs%2Ftahoe-lafs.git bin/tahoe-script.template: On non-Windows, invoke support/bin/tahoe directly as a script (rather than via python), so that 'top' for example will show it as 'tahoe'. On Windows, simplify some code that set argv[0], which is never used. fixes #174 --- diff --git a/bin/tahoe-script.template b/bin/tahoe-script.template index 5e2c12fa..622cca3f 100644 --- a/bin/tahoe-script.template +++ b/bin/tahoe-script.template @@ -72,22 +72,21 @@ if sys.platform == "win32": if not arg.startswith(u"-") or arg == u"-": break argv = argv[1:] - if arg == u'-m': - # sys.argv[0] should really be the absolute path of the module source, but never mind - break - if arg == u'-c': - argv[0] = u'-c' + if arg == u'-m' or arg == u'-c': break - local_tahoe = "Scripts\\tahoe.pyscript" + script = os.path.join(base, "support", "Scripts", "tahoe.pyscript") + + # On Windows, the script is not directly executable and must be run via python. + args = [sys.executable, script] + argv[1:] else: - argv = sys.argv - local_tahoe = "bin/tahoe" + script = os.path.join(base, "support", "bin", "tahoe") -script = os.path.join(base, "support", local_tahoe) + # On non-Windows, invoke the script directly, so that 'top' for example shows 'tahoe'. + args = [script] + sys.argv[1:] try: - res = subprocess.call([sys.executable, script] + argv[1:], env=os.environ) + res = subprocess.call(args, env=os.environ) except (OSError, IOError), le: if le.args[0] == errno.ENOENT: print whoami