sassw: let subprocess.run handle text encoding
This commit is contained in:
parent
b351f2e8aa
commit
e7d34ce082
|
@ -25,9 +25,10 @@ def build():
|
|||
global sources, directories
|
||||
result = subprocess.run(
|
||||
['sassc', '-mauto', filename, filename.replace('.scss', '.css')],
|
||||
capture_output=True)
|
||||
sys.stdout.write(result.stdout.decode('utf-8'))
|
||||
sys.stderr.write(result.stderr.decode('utf-8'))
|
||||
capture_output=True,
|
||||
text=True)
|
||||
sys.stdout.write(result.stdout)
|
||||
sys.stderr.write(result.stderr)
|
||||
if result.returncode:
|
||||
# error
|
||||
with open(filename.replace('.scss', '.css'), 'w') as fd:
|
||||
|
@ -35,7 +36,7 @@ def build():
|
|||
white-space: pre;
|
||||
font-family: monospace;
|
||||
content: "%s";
|
||||
}''' % result.stderr.decode('utf-8').replace('\n', '\\A').replace('"', '\\"'),
|
||||
}''' % result.stderr.replace('\n', '\\A').replace('"', '\\"'),
|
||||
file=fd)
|
||||
basepath = os.path.abspath(os.path.dirname(filename))
|
||||
sources = [os.path.abspath(os.path.join(basepath, x)) for x in json.load(open(filename.replace('.scss', '.css.map')))['sources']]
|
||||
|
|
Loading…
Reference in New Issue