Created
July 12, 2016 11:04
-
-
Save rshk/85b7345a9c0c429ab60d1e94aedb0fc5 to your computer and use it in GitHub Desktop.
Fix ionic2 build output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For some reason, it looks like Ionic2 CLI prints log messages as | |
# something like 0=72, 1=101, 2=108, 3=108, 4=111 | |
# (Looks like a representation of binary strings?) | |
# Pipe that output through this script to fix. | |
import re | |
import sys | |
re_garbled_line = re.compile(r'^\s*([0-9]+=[0-9]+(, )?)+$') | |
def fix_line(data): | |
return ''.join([ | |
chr(int(x.strip().split('=')[1])) | |
for x in data.split(', ') | |
]) | |
for line in sys.stdin: | |
if re_garbled_line.match(line): | |
line = fix_line(line) | |
sys.stdout.write(line) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment