From c3a6139f83f75323c1c99f00247b9762eff427f7 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Mon, 14 Mar 2022 00:57:24 -0400 Subject: [PATCH] Run image from temporary copy to avoid modified disk image file --- Rsconscript | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Rsconscript b/Rsconscript index 50140a7..3411937 100644 --- a/Rsconscript +++ b/Rsconscript @@ -1,3 +1,5 @@ +require "tmpdir" + project_name "HOS" path_prepend "x86_64-elf-gcc/bin" @@ -85,6 +87,9 @@ hel_env = env "hel", use: %w[ldc2 x86_64-w64-mingw32-gcc] do |env| end task "run", desc: "Run HOS in QEMU" do - img = hel_env.expand("^/hos.img") - sh %W[qemu-system-x86_64 -bios OVMF.fd -drive file=#{img},format=raw] + Dir.mktmpdir do |tmpdir| + img = hel_env.expand("^/hos.img") + FileUtils.cp(img, tmpdir) + sh %W[qemu-system-x86_64 -bios OVMF.fd -drive file=#{tmpdir}/hos.img,format=raw] + end end