Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
run: cargo build --locked

- name: Test
run: cargo test && cargo test -- --ignored
run: cargo test
50 changes: 43 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ chrono = "0.4"
clap = { version = "4", features = ["derive", "env", "wrap_help"] }
dropshot = "0.16"
ed25519-dalek = { version = "2", features = ["rand_core"] }
humantime = "2"
libc = "0.2"
p256 = { version = "0.13", features = ["ecdsa"] }
pem-rfc7468 = { version = "0.7", features = ["std"] }
Expand All @@ -19,9 +20,10 @@ permission-slip-common = { git = "https://github.com/oxidecomputer/permission-sl
progenitor = "0.11"
rand_core = "0.6"
reqwest = "0.12"
rlimit = "0.10"
rusqlite = { version = "0.37", features = ["blob", "chrono", "limits", "modern_sqlite", "uuid"] }
rustyline = "17"
schemars = { version = "0.8", features = ["chrono", "uuid1"] }
schemars = { version = "0.8", features = ["chrono", "preserve_order", "uuid1"] }
serde = "1"
serde_json = "1"
sha2 = "0.10"
Expand Down
1 change: 1 addition & 0 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ blake3.workspace = true
bytesize.workspace = true
chrono.workspace = true
clap.workspace = true
humantime.workspace = true
libc.workspace = true
pem-rfc7468.workspace = true
permission-slip-client.workspace = true
Expand Down
31 changes: 25 additions & 6 deletions client/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::path::Path;

use bytesize::ByteSize;
use chrono::{DateTime, Utc};
use humantime::format_duration;
use serde_json::json;
use x509_cert::Certificate;
use x509_cert::der::Encode as _;
Expand Down Expand Up @@ -182,7 +183,12 @@ impl CommandContext for Cli {
OutputFormat::Text if output.is_empty() => (),
OutputFormat::Text => {
println!("✅ Job {job_id} stdout:");
print!("{}", String::from_utf8(output.to_vec())?);
let output = String::from_utf8(output.to_vec())?;
if output.ends_with('\n') {
print!("{output}");
} else {
println!("{output}");
}
}
}
Ok(())
Expand All @@ -201,7 +207,12 @@ impl CommandContext for Cli {
OutputFormat::Text if errors.is_empty() => (),
OutputFormat::Text => {
println!("❌ Job {job_id} stderr:");
print!("{}", String::from_utf8(errors.to_vec())?);
let errors = String::from_utf8(errors.to_vec())?;
if errors.ends_with('\n') {
print!("{errors}");
} else {
println!("{errors}");
}
}
}
Ok(())
Expand Down Expand Up @@ -235,17 +246,18 @@ impl CommandContext for Cli {
time_reserved,
time_started,
time_ended,
status: Some(status),
status: Some(exit_status),
stdout_len,
stderr_len,
} => println!(
"✅ Job ID:\t{job_id}\n \
Reserved at:\t{time_reserved}\n \
Started at:\t{time_started}\n \
Ended at:\t{time_ended}\n \
Status:\t{status}\n \
Ended at:\t{time_ended} ({})\n \
Status:\t{exit_status}\n \
Stdout:\t{}\n \
Stderr:\t{}",
format_duration(status.time_elapsed().unwrap().to_std()?),
ByteSize::b(*stdout_len as u64).display().si(),
ByteSize::b(*stderr_len as u64).display().si(),
),
Expand All @@ -254,12 +266,19 @@ impl CommandContext for Cli {
time_started,
time_ended,
status: None,
stdout_len,
stderr_len,
..
} => println!(
"✅ Job ID:\t{job_id}\n \
Reserved at:\t{time_reserved}\n \
Started at:\t{time_started}\n \
Aborted at:\t{time_ended}",
Aborted at:\t{time_ended} ({})\n \
Stdout:\t{}\n \
Stderr:\t{}",
format_duration(status.time_elapsed().unwrap().to_std()?),
ByteSize::b(*stdout_len as u64).display().si(),
ByteSize::b(*stderr_len as u64).display().si(),
),
},
}
Expand Down
Loading