Commits

Steve Borho  committed 8dacfd6

thg: ensure COMSPEC is set when launched in frozen environment

When launched from a desktop shortcut, COMSPEC may not be set while
os.Popen() relies on this variable.

  • Participants
  • Parent commits aeb04c1

Comments (0)

Files changed (1)

     if sys.frozen == 'windows_exe' and 'THGDEBUG' in os.environ:
         import win32traceutil
         print 'starting'
+    # os.Popen() needs this, and Mercurial still uses os.Popen
+    if 'COMSPEC' not in os.environ:
+        comspec = os.path.join(os.environ.get('SystemRoot', r'C:\Windows'),
+                               'system32', 'cmd.exe')
+        os.environ['COMSPEC'] = comspec
 else:
     thgpath = os.path.dirname(os.path.realpath(__file__))
     testpath = os.path.join(thgpath, 'tortoisehg')