tools/qvm-run: do not color the output unless --pass-io is used

Since no output from VM is passed (and even if it would, it's redirected
to /dev/null), there is no need to switch output color.
This fixes the case when qvm-run is started in background - the color
change would affect further shell output.

Fixes QubesOS/qubes-issues#4808
This commit is contained in:
Marek Marczykowski-Górecki 2019-02-11 19:23:35 +01:00
parent 89ee4931fb
commit b1a191446a
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -197,11 +197,12 @@ def run_command_single(args, vm):
def main(args=None, app=None): def main(args=None, app=None):
'''Main function of qvm-run tool''' '''Main function of qvm-run tool'''
args = parser.parse_args(args, app=app) args = parser.parse_args(args, app=app)
if args.color_output is None and args.filter_esc: if args.passio:
args.color_output = '31' if args.color_output is None and args.filter_esc:
args.color_output = 31
if args.color_stderr is None and os.isatty(sys.stderr.fileno()): if args.color_stderr is None and os.isatty(sys.stderr.fileno()):
args.color_stderr = 31 args.color_stderr = 31
if len(args.domains) > 1 and args.passio and not args.localcmd: if len(args.domains) > 1 and args.passio and not args.localcmd:
parser.error('--passio cannot be used when more than 1 qube is chosen ' parser.error('--passio cannot be used when more than 1 qube is chosen '