@@ -312,20 +312,38 @@ pub fn run_qemu(arch: UefiArch, opt: &QemuOpt) -> Result<()> {
312312 UefiArch :: AArch64 => "qemu-system-aarch64" ,
313313 UefiArch :: IA32 | UefiArch :: X86_64 => "qemu-system-x86_64" ,
314314 } ;
315- let mut cmd = Command :: new ( qemu_exe) ;
316315
317- if platform :: is_windows ( ) {
318- // The QEMU installer for Windows does not automatically add the
319- // directory containing the QEMU executables to the PATH. Add
320- // the default directory to the PATH to make it more likely that
321- // QEMU will be found on Windows. (The directory is appended, so
322- // if a different directory on the PATH already has the QEMU
323- // binary this change won't affect anything.)
316+ // The QEMU installer for Windows does not automatically add the
317+ // directory containing the QEMU executables to the PATH. Add
318+ // the default directory to the PATH to make it more likely that
319+ // QEMU will be found on Windows. (The directory is appended, so
320+ // if a different directory on the PATH already has the QEMU
321+ // binary this change won't affect anything.)
322+ let fn_append_win_path = | cmd : & mut Command | {
324323 let mut path = env:: var_os ( "PATH" ) . unwrap_or_default ( ) ;
325324 path. push ( r";C:\Program Files\qemu" ) ;
326325 cmd. env ( "PATH" , path) ;
326+ } ;
327+
328+ // Print the QEMU version
329+ {
330+ let mut cmd = Command :: new ( qemu_exe) ;
331+ if platform:: is_windows ( ) {
332+ fn_append_win_path ( & mut cmd)
333+ } ;
334+ cmd. arg ( "--version" ) ;
335+ let output = cmd. output ( ) ?;
336+ eprintln ! ( "QEMU:" ) ;
337+ eprintln ! ( " binary : {qemu_exe}" ) ;
338+ eprintln ! ( " version: {}" , String :: from_utf8( output. stdout) ?) ;
327339 }
328340
341+ // Construct the actual QEMU argument
342+ let mut cmd = Command :: new ( qemu_exe) ;
343+ if platform:: is_windows ( ) {
344+ fn_append_win_path ( & mut cmd)
345+ } ;
346+
329347 // Disable default devices.
330348 // QEMU by defaults enables a ton of devices which slow down boot.
331349 cmd. arg ( "-nodefaults" ) ;
0 commit comments