Commits

Yuya Nishihara committed 2babc4f

workbench: use windows-safe getuser() to build IPC socket name (fixes #2238)

On Windows, if USERNAME-like environment is not set, getpass.getuser() fails.
Instead, this changes to use GetUserNameA() on Windows.

Comments (0)

Files changed (1)

tortoisehg/hgqt/workbench.py

 
 import os
 import sys
-import getpass # used to get the username on the workbench server
 from mercurial import ui, util
 from mercurial.error import RepoError
 from tortoisehg.util import paths, hglib
     def createWorkbenchServer(self):
         self.server = QLocalServer()
         self.server.newConnection.connect(self.newConnection)
-        self.server.listen(qApp.applicationName()+ '-' + getpass.getuser())
+        self.server.listen(qApp.applicationName() + '-' + util.getuser())
 
     def newConnection(self):
         socket = self.server.nextPendingConnection()
     else:
         data = '[echo]'
     socket = QLocalSocket()
-    socket.connectToServer(qApp.applicationName() + '-' + getpass.getuser(),
+    socket.connectToServer(qApp.applicationName() + '-' + util.getuser(),
         QIODevice.ReadWrite)
     if socket.waitForConnected(10000):
         # Momentarily let any process set the foreground window