forked from lix-project/lix-installer
Add newline to end of plan json output (#283)
* Add newline to end of `plan` json output This causes some shells (like sh) to continue their prompt right after the closing brace, which is kinda meh. * Add newline to end of `receipt.json` `cat /nix/receipt.json` has the same issue as the previous commit, in that it will bleed into the prompt for some shells that don't insert an implicit newline. * Add newline to end of fixture json documents
This commit is contained in:
parent
d49e12cd7d
commit
9c8284cd06
|
@ -44,7 +44,7 @@ impl CommandExecute for Plan {
|
||||||
};
|
};
|
||||||
|
|
||||||
let json = serde_json::to_string_pretty(&install_plan)?;
|
let json = serde_json::to_string_pretty(&install_plan)?;
|
||||||
tokio::fs::write(output, json)
|
tokio::fs::write(output, format!("{json}\n"))
|
||||||
.await
|
.await
|
||||||
.wrap_err("Writing plan")?;
|
.wrap_err("Writing plan")?;
|
||||||
|
|
||||||
|
|
|
@ -331,7 +331,7 @@ async fn write_receipt(plan: InstallPlan) -> Result<(), NixInstallerError> {
|
||||||
let install_receipt_path = PathBuf::from(RECEIPT_LOCATION);
|
let install_receipt_path = PathBuf::from(RECEIPT_LOCATION);
|
||||||
let self_json =
|
let self_json =
|
||||||
serde_json::to_string_pretty(&plan).map_err(NixInstallerError::SerializingReceipt)?;
|
serde_json::to_string_pretty(&plan).map_err(NixInstallerError::SerializingReceipt)?;
|
||||||
tokio::fs::write(&install_receipt_path, self_json)
|
tokio::fs::write(&install_receipt_path, format!("{self_json}\n"))
|
||||||
.await
|
.await
|
||||||
.map_err(|e| NixInstallerError::RecordingReceipt(install_receipt_path, e))?;
|
.map_err(|e| NixInstallerError::RecordingReceipt(install_receipt_path, e))?;
|
||||||
Result::<(), NixInstallerError>::Ok(())
|
Result::<(), NixInstallerError>::Ok(())
|
||||||
|
|
2
tests/fixtures/linux/linux.json
vendored
2
tests/fixtures/linux/linux.json
vendored
|
@ -915,4 +915,4 @@
|
||||||
"start_daemon": true
|
"start_daemon": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
tests/fixtures/linux/steam-deck.json
vendored
2
tests/fixtures/linux/steam-deck.json
vendored
|
@ -937,4 +937,4 @@
|
||||||
"start_daemon": true
|
"start_daemon": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
tests/fixtures/macos/macos.json
vendored
2
tests/fixtures/macos/macos.json
vendored
|
@ -969,4 +969,4 @@
|
||||||
"volume_label": "Nix Store",
|
"volume_label": "Nix Store",
|
||||||
"root_disk": "disk3"
|
"root_disk": "disk3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue