Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a999db54a8 | ||
|
|
83a1784fca |
No files matched your search
+10
-1
@@ -148,8 +148,17 @@ async fn visit(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
let digest = resolve_digest(ch, name, tag)
|
let digest = resolve_digest(ch, name, tag)
|
||||||
let m = fetch_manifest(ch, name, digest)
|
|
||||||
let prev = p.ctx.state.get(name)
|
let prev = p.ctx.state.get(name)
|
||||||
|
// An unchanged build with a saved description needs no metadata fetch.
|
||||||
|
let m = match prev {
|
||||||
|
Some(i) =>
|
||||||
|
if i.digest == digest && i.description != "" {
|
||||||
|
manifest_of_installed(i)
|
||||||
|
} else {
|
||||||
|
fetch_manifest(ch, name, digest)
|
||||||
|
}
|
||||||
|
None => fetch_manifest(ch, name, digest)
|
||||||
|
}
|
||||||
let st = Step::{
|
let st = Step::{
|
||||||
name,
|
name,
|
||||||
channel: ch.name,
|
channel: ch.name,
|
||||||
|
|||||||
+28
-13
@@ -276,25 +276,40 @@ async fn sh_ok(cmd : String) -> Unit raise OrbitError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
/// Return stdout; stderr goes to the terminal unless captured. A label enables delayed progress spinner.
|
/// Braille spinner on stderr until cancelled.
|
||||||
async fn capture(cmd : String, progress? : String = "") -> String raise OrbitError {
|
async fn spin(label : String) -> Unit noraise {
|
||||||
let is_tty = c_isatty(2) != 0 && getenv("TERM") != "dumb"
|
let frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]
|
||||||
let res : Result[String, Error] = try {
|
|
||||||
let out = @async.with_task_group((group) => {
|
|
||||||
if is_tty && progress != "" {
|
|
||||||
group.spawn_bg(async fn() {
|
|
||||||
@async.sleep(250)
|
|
||||||
let frames = ["|", "/", "-", "\\"]
|
|
||||||
let mut i = 0
|
let mut i = 0
|
||||||
while true {
|
while true {
|
||||||
c_print_err(utf8_encode("\r\u001B[2K" + frames[i % 4] + " " + progress))
|
c_print_err(utf8_encode("\r\u001B[2K" + frames[i % 10] + " " + label))
|
||||||
i = i + 1
|
i = i + 1
|
||||||
@async.sleep(100)
|
@async.sleep(80)
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
/// Return stdout; stderr goes to the terminal unless captured. A label shows a
|
||||||
|
/// braille spinner on a terminal while the command runs. The spinner is a child
|
||||||
|
/// task that is cancelled as soon as the command finishes, so nothing keeps the
|
||||||
|
/// group alive.
|
||||||
|
async fn capture(cmd : String, progress~ : String = "") -> String raise OrbitError {
|
||||||
|
let is_tty = c_isatty(2) != 0 && getenv("TERM") != "dumb"
|
||||||
|
let spinning = is_tty && progress != ""
|
||||||
|
let res : Result[String, Error] = try {
|
||||||
|
let out = @async.with_task_group(group => {
|
||||||
|
let spinner = if spinning {
|
||||||
|
Some(group.spawn(() => {
|
||||||
|
ignore(@async.handle_cancellation(() => spin(progress)))
|
||||||
|
}))
|
||||||
|
} else {
|
||||||
|
None
|
||||||
}
|
}
|
||||||
let (code, stdout, _) = @process.collect_output("sh", ["-c", cmd])
|
let (code, stdout, _) = @process.collect_output("sh", ["-c", cmd])
|
||||||
if is_tty && progress != "" {
|
match spinner {
|
||||||
|
Some(task) => task.cancel()
|
||||||
|
None => ()
|
||||||
|
}
|
||||||
|
if spinning {
|
||||||
c_print_err(utf8_encode("\r\u001B[2K"))
|
c_print_err(utf8_encode("\r\u001B[2K"))
|
||||||
}
|
}
|
||||||
if code != 0 {
|
if code != 0 {
|
||||||
|
|||||||
Reference in new issue
Block a user