##// END OF EJS Templates
lock: encode result of gethostname into a bytestring
Augie Fackler -
r31375:d57aa655 default
parent child Browse files
Show More
@@ -15,6 +15,7 b' import time'
15 import warnings
15 import warnings
16
16
17 from . import (
17 from . import (
18 encoding,
18 error,
19 error,
19 pycompat,
20 pycompat,
20 util,
21 util,
@@ -27,7 +28,8 b' def _getlockprefix():'
27 confidence. Typically it's just hostname. On modern linux, we include an
28 confidence. Typically it's just hostname. On modern linux, we include an
28 extra Linux-specific pid namespace identifier.
29 extra Linux-specific pid namespace identifier.
29 """
30 """
30 result = socket.gethostname()
31 result = socket.gethostname().encode(
32 pycompat.sysstr(encoding.encoding), 'replace')
31 if pycompat.sysplatform.startswith('linux'):
33 if pycompat.sysplatform.startswith('linux'):
32 try:
34 try:
33 result += '/%x' % os.stat('/proc/self/ns/pid').st_ino
35 result += '/%x' % os.stat('/proc/self/ns/pid').st_ino
General Comments 0
You need to be logged in to leave comments. Login now