Fix step logging
This commit is contained in:
parent
ceeaed0b8d
commit
bc44b249f4
|
@ -73,7 +73,10 @@ impl<'a> Step<'a> {
|
||||||
match self {
|
match self {
|
||||||
Self::DownloadFile { res, file } => {
|
Self::DownloadFile { res, file } => {
|
||||||
if file.exists() {
|
if file.exists() {
|
||||||
println!("File {file} already downloaded.");
|
println!(
|
||||||
|
"File {file} already downloaded.",
|
||||||
|
file = file.to_str().unwrap_or("<NON UTF-8>")
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
println!(
|
println!(
|
||||||
"Downloading file {file} from {res:?}...",
|
"Downloading file {file} from {res:?}...",
|
||||||
|
@ -147,6 +150,11 @@ impl<'a> Step<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Self::ExtractFile { file, dest } => {
|
Self::ExtractFile { file, dest } => {
|
||||||
|
println!(
|
||||||
|
"Extracting {file} to {dest}...",
|
||||||
|
file = file.to_str().unwrap_or("<NON UTF-8>"),
|
||||||
|
dest = dest.to_str().unwrap_or("<NON UTF-8>")
|
||||||
|
);
|
||||||
const EXTRACT_FILE_ERROR_MSG: &'static str = "Extracting file failed.";
|
const EXTRACT_FILE_ERROR_MSG: &'static str = "Extracting file failed.";
|
||||||
mkdir_all(&dest).await.wrap_err(EXTRACT_FILE_ERROR_MSG)?;
|
mkdir_all(&dest).await.wrap_err(EXTRACT_FILE_ERROR_MSG)?;
|
||||||
let dest = tokio::fs::canonicalize(&dest)
|
let dest = tokio::fs::canonicalize(&dest)
|
||||||
|
@ -166,6 +174,11 @@ impl<'a> Step<'a> {
|
||||||
ensure!(status.success(), EXTRACT_FILE_ERROR_MSG);
|
ensure!(status.success(), EXTRACT_FILE_ERROR_MSG);
|
||||||
}
|
}
|
||||||
Self::ExecuteCommand { file, args } => {
|
Self::ExecuteCommand { file, args } => {
|
||||||
|
println!(
|
||||||
|
"Executing command `{file} {args}`...",
|
||||||
|
file = file.to_str().unwrap_or("<NON UTF-8>"),
|
||||||
|
args = args.into_iter().map(|s| *s).collect::<String>(),
|
||||||
|
);
|
||||||
const EXECUTE_COMMAND_ERROR_MSG: &'static str = "Executing command failed.";
|
const EXECUTE_COMMAND_ERROR_MSG: &'static str = "Executing command failed.";
|
||||||
let status = tokio::process::Command::new(file.as_os_str())
|
let status = tokio::process::Command::new(file.as_os_str())
|
||||||
.args(*args)
|
.args(*args)
|
||||||
|
@ -178,6 +191,10 @@ impl<'a> Step<'a> {
|
||||||
ensure!(status.success(), EXECUTE_COMMAND_ERROR_MSG);
|
ensure!(status.success(), EXECUTE_COMMAND_ERROR_MSG);
|
||||||
}
|
}
|
||||||
Self::CreateShortcut { target, file } => {
|
Self::CreateShortcut { target, file } => {
|
||||||
|
println!(
|
||||||
|
"Creating shortcut to {target:?} at {file}...",
|
||||||
|
file = file.to_str().unwrap_or("<NON UTF-8>")
|
||||||
|
);
|
||||||
const CREATE_SHORTCUT_ERROR_MSG: &'static str = "Creating shortcut failed.";
|
const CREATE_SHORTCUT_ERROR_MSG: &'static str = "Creating shortcut failed.";
|
||||||
mkdir_all(
|
mkdir_all(
|
||||||
file.parent().ok_or_else(|| {
|
file.parent().ok_or_else(|| {
|
||||||
|
|
Loading…
Reference in New Issue