From e60347026051e7d1af1c1d5aec4799475f36ecbb Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 5 Jan 2016 08:00:35 +0100 Subject: [PATCH] Fix asciidoc2html on Windows. Windows needs the SystemRoot environment variable set to initialize the crypto API, what running Python in a subprocess does. However, we did override the whole environment instead of extending it, which means this broke on Windows when calling asciidoc: Traceback (most recent call last): File "C:\asciidoc-8.6.9\asciidoc.py", line 9, in import sys, os, re, time, traceback, tempfile, subprocess, codecs, locale, unicodedata, copy File "C:\Python27\lib\tempfile.py", line 35, in from random import Random as _Random File "C:\Python27\lib\random.py", line 885, in _inst = Random() File "C:\Python27\lib\random.py", line 97, in __init__ self.seed(x) File "C:\Python27\lib\random.py", line 113, in seed a = long(_hexlify(_urandom(2500)), 16) WindowsError: [Error -2146893795] Provider DLL failed to initialize correctly --- scripts/asciidoc2html.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/asciidoc2html.py b/scripts/asciidoc2html.py index 5a0f46d99..7ef118c4f 100755 --- a/scripts/asciidoc2html.py +++ b/scripts/asciidoc2html.py @@ -226,7 +226,9 @@ class AsciiDoc: cmdline += args cmdline.append(src) try: - subprocess.check_call(cmdline, env={'HOME': self._homedir}) + env = os.environ.copy() + env['HOME'] = self._homedir + subprocess.check_call(cmdline, env=env) self._failed = True except (subprocess.CalledProcessError, OSError) as e: self._failed = True