From 9815852a095827769d04afd0aab196f79d07e8cb Mon Sep 17 00:00:00 2001 From: david-sarah Date: Sat, 27 Nov 2010 15:26:50 -0800 Subject: [PATCH] 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 --- bin/tahoe-script.template | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) 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 -- 2.45.2