summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2015-11-15 19:58:02 -0600
committerMichael Merickel <michael@merickel.org>2015-11-15 19:58:02 -0600
commit0db007eab88c8266d070b07984b3a7ef312ed1aa (patch)
tree16443f884c6d7106216c17b9bf69c7b3ba1f5121
parent9da7c4a482f9fcda15d21ae6fc2e0dd5956cf7dc (diff)
parentb9f8dcfdb745c81a437549922f04d03ae7f45614 (diff)
downloadpyramid-0db007eab88c8266d070b07984b3a7ef312ed1aa.tar.gz
pyramid-0db007eab88c8266d070b07984b3a7ef312ed1aa.tar.bz2
pyramid-0db007eab88c8266d070b07984b3a7ef312ed1aa.zip
Merge pull request #2137 from mmerickel/fix/pserve-windows-reload
add .exe to the script being invoked if missing on windows
-rw-r--r--pyramid/scripts/pserve.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/pyramid/scripts/pserve.py b/pyramid/scripts/pserve.py
index efad0cc68..95752a3be 100644
--- a/pyramid/scripts/pserve.py
+++ b/pyramid/scripts/pserve.py
@@ -428,6 +428,19 @@ a real process manager for your processes like Systemd, Circus, or Supervisor.
arg = win32api.GetShortPathName(arg)
return arg
+ def find_script_path(self, name): # pragma: no cover
+ """
+ Return the path to the script being invoked by the python interpreter.
+
+ There's an issue on Windows when running the executable from
+ a console_script causing the script name (sys.argv[0]) to
+ not end with .exe or .py and thus cannot be run via popen.
+ """
+ if sys.platform == 'win32':
+ if not name.endswith('.exe') and not name.endswith('.py'):
+ name += '.exe'
+ return name
+
def daemonize(self): # pragma: no cover
pid = live_pidfile(self.options.pid_file)
if pid:
@@ -573,7 +586,10 @@ a real process manager for your processes like Systemd, Circus, or Supervisor.
else:
self.out('Starting subprocess with monitor parent')
while 1:
- args = [self.quote_first_command_arg(sys.executable)] + sys.argv
+ args = [
+ self.quote_first_command_arg(sys.executable),
+ self.find_script_path(sys.argv[0]),
+ ] + sys.argv[1:]
new_environ = os.environ.copy()
if reloader:
new_environ[self._reloader_environ_key] = 'true'