_ServiceSpawner: add 'SYSTEMROOT' to environment if Windows

Python 3 cannot be started without SYSTEMROOT environment variable.
Otherwise, CryptAcquireContext() is unable to find a dll.

https://bugs.python.org/issue20614

Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
This commit is contained in:
Alejandro del Castillo
2018-07-05 23:05:39 -05:00
parent 9640364713
commit 39aed3a5a0

View File

@@ -41,6 +41,7 @@ A hub-managed service with no URL::
import pipes
import shutil
import os
from subprocess import Popen
from traitlets import (
@@ -104,6 +105,8 @@ class _ServiceSpawner(LocalProcessSpawner):
def start(self):
"""Start the process"""
env = self.get_env()
if os.name == 'nt':
env['SYSTEMROOT'] = os.environ['SYSTEMROOT']
cmd = self.cmd
self.log.info("Spawning %s", ' '.join(pipes.quote(s) for s in cmd))