mirror of
https://github.com/floci-io/floci-cli.git
synced 2026-11-22 21:50:47 -05:00
fix(cli): keep wait's spinner out of -o json, reject bad durations and make --verbose work (#48)
* fix(cli): keep wait's spinner out of -o json, reject bad durations and make --verbose work wait draws its spinner only for text output on a terminal and clears it before the result; --timeout values that are not a positive number with ms, s, m or h exit 2 with a hint instead of a stack trace; --verbose now echoes each docker command to stderr and prints stack traces for errors. * fix(cli): reject durations that overflow and pin the spinner rule on a terminal A duration is checked for sign before it is converted and the conversion is overflow-checked, so -9223372036854775807s no longer wraps to a positive timeout. wait takes its terminal check through a seam, with tests for json, yaml and text output on a terminal.
This commit is contained in:
1 parent
7ecc895baa
commit
52ebdee98d
8 files changed
+230
-10
No files matched your search
@@ -1,5 +1,7 @@
|
||||
package io.floci.cli.docker;
|
||||
|
||||
import io.floci.cli.GlobalOptions;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -266,6 +268,9 @@ public class DockerClient {
|
||||
}
|
||||
|
||||
private Process runProcess(String... cmd) throws IOException {
|
||||
if (Boolean.getBoolean(GlobalOptions.VERBOSE_PROPERTY)) {
|
||||
System.err.println("+ " + String.join(" ", cmd));
|
||||
}
|
||||
if (cmd.length > 0 && "docker".equals(cmd[0])) {
|
||||
cmd = cmd.clone();
|
||||
cmd[0] = binary;
|
||||
|
||||
Reference in new issue
Block a user