fix cmd macro misinterpreting quoted strings

This commit is contained in:
everyone 2023-11-08 19:10:52 -08:00
parent 336939581d
commit 433fc1af7d
Signed by: everyone
SSH key fingerprint: SHA256:FKcGHdUnp2OocVUUAEJV25QetYQXwbmKPSsblofJOrM

View file

@ -60,7 +60,7 @@ macro_rules! cmd {
($command:tt $($args:expr) +$(, $format:tt)*) => {
let args = cmd!{@replace $($args) +; $( $format),*}.replace("- -", "--");
let _ = std::process::Command::new(stringify!($command))
.args(args.split_whitespace())
.args(args.replace("\"", "").split_whitespace())
.spawn()
.expect("Command failed to spawn")
.wait();
@ -231,7 +231,7 @@ fn main() {
mount(&disks[root][0], 1, "/mnt/boot", None);
if swap {
cmd! {btrfs subvolume create "/mnt/swap"}
cmd! {btrfs filesystem mkswapfile --size {} --uuid clear "/mnt/swap/swapfile", swap_size};
cmd! {swapon "/mnt/swap/swapfile"}
cmd! {btrfs filesystem mkswapfile --size {} --uuid clear "/mnt/swap/file", swap_size};
cmd! {swapon "/mnt/swap/file"}
}
}