Permalink
Browse files

Fix crash on constructing log message with non-ASCII paths

  • Loading branch information...
gthb committed Nov 22, 2011
1 parent f23e111 commit 7d22b8f753e3a0203a7061a5359fadd847024ea1
Showing with 6 additions and 1 deletion.
  1. +6 −1 virtualenv.py
View
@@ -844,8 +844,13 @@ def call_subprocess(cmd, show_stdout=True,
part = part[:20]+"..."+part[-20:]
if ' ' in part or '\n' in part or '"' in part or "'" in part:
part = '"%s"' % part.replace('"', '\\"')
+ if isinstance(part, str):
+ try:
+ part = part.decode(sys.getdefaultencoding())
+ except UnicodeDecodeError:
+ part = part.decode(sys.getfilesystemencoding())
cmd_parts.append(part)
- cmd_desc = ' '.join(cmd_parts)
+ cmd_desc = u' '.join(cmd_parts)
if show_stdout:
stdout = None
else:

0 comments on commit 7d22b8f

Please sign in to comment.