Hide sensitive information from getting displayed/logged.
import os
import sys
import subprocess
+import re
from collections import namedtuple
from conans import tools
@@ -376,7 +377,11 @@ class PrintRunner(object):
self.printer = printer
def __call__(self, command):
- self.printer.print_command(command)
+ cmd_str = command
+ if hide_sensitive:
+ cmd_str = re.sub(r'(CONAN_LOGIN_USERNAME[_\w+]*)=\"(\w+)\"', r'\1="xxxxxxxx"', cmd_str)
+ cmd_str = re.sub(r'(CONAN_PASSWORD[_\w+]*)=\"(\w+)\"', r'\1="xxxxxxxx"', cmd_str)
+ self.printer.print_command(cmd_str)
sys.stderr.flush()
sys.stdout.flush()
return self.runner(command)
