From 8a571cba310619e3dd48c48cbc208ca2366d8854 Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Mon, 8 Oct 2018 16:07:29 -0700 Subject: [PATCH] Log command line run on qemu This makes it easier to debug and customize what we are running when calling qemu. And example customization might be: sudo mkosi --default mkosi.fedora qemu \ -drive if=pflash,format=raw,file=myvars.fd --- mkosi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mkosi b/mkosi index b22e4bfe1..f9b97f97f 100755 --- a/mkosi +++ b/mkosi @@ -16,6 +16,7 @@ import hashlib import os import platform import re +import shlex import shutil import stat import string @@ -148,6 +149,10 @@ def roundup512(x): def print_step(text): sys.stderr.write("‣ \033[0;1;39m" + text + "\033[0m\n") +def print_running_cmd(cmdline): + sys.stderr.write("‣ \033[0;1;39mRunning command:\033[0m\n") + sys.stderr.write(" ".join(shlex.quote(x) for x in cmdline) + "\n") + def mkdir_last(path, mode=0o777): """Create directory path @@ -3624,6 +3629,8 @@ def run_qemu(args): "-drive", "format=raw,file=" + args.output, *args.cmdline ] + print_running_cmd(cmdline) + os.execvp(cmdline[0], cmdline) def expand_paths(paths): -- 2.47.2