Created
November 14, 2019 21:38
-
-
Save ajdavis/2e4c22263a62bbd64362e643a1dde692 to your computer and use it in GitHub Desktop.
Script for use with CLion to make a custom build tool's path outputs absolute, so they are clickable in CLion's output window.
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
#!/usr/bin/env python3 | |
import re | |
import subprocess | |
import sys | |
proc = subprocess.Popen(sys.argv[1:], stdout=subprocess.PIPE) | |
for line in iter(proc.stdout.readline, b''): | |
match = re.match(rb'src/[\w_/.]+:\d+.*', line) | |
if match: | |
# Use sys.stdout.buffer for bytes. | |
sys.stdout.buffer.write(b'/mirror/co/mongo/') | |
sys.stdout.buffer.write(line) | |
sys.stdout.buffer.flush() | |
proc.stdout.close() | |
proc.wait() | |
sys.exit(proc.returncode) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment