зеркало из https://github.com/mozilla/sccache.git
Merge pull request #1 from mshal/bug-1006582
Bug 1006582 - Set output encoding in case of file redirects; r=glandium
This commit is contained in:
Коммит
2eab09769f
10
sccache.py
10
sccache.py
|
@ -17,9 +17,19 @@ import json
|
|||
import os
|
||||
import socket
|
||||
import sys
|
||||
import codecs
|
||||
import locale
|
||||
from base_server import CommandClient, PORT
|
||||
from errno import ECONNREFUSED
|
||||
|
||||
# Set the output encoding in case the output is being redirected to a file. In
|
||||
# this case, the default encoding is ASCII, but we may have unicode characters
|
||||
# in stderr/stdout, which causes python to report a UnicodeEncodeError.
|
||||
if not sys.stdout.encoding:
|
||||
sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.stdout);
|
||||
if not sys.stderr.encoding:
|
||||
sys.stderr = codecs.getwriter(locale.getpreferredencoding())(sys.stderr);
|
||||
|
||||
if __name__ == '__main__':
|
||||
cmd = sys.argv[1:]
|
||||
if cmd:
|
||||
|
|
Загрузка…
Ссылка в новой задаче