Skip to content

Instantly share code, notes, and snippets.

@rshk
Created July 12, 2016 11:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rshk/85b7345a9c0c429ab60d1e94aedb0fc5 to your computer and use it in GitHub Desktop.
Save rshk/85b7345a9c0c429ab60d1e94aedb0fc5 to your computer and use it in GitHub Desktop.
Fix ionic2 build output
# 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