| 16 | type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>; |
| 17 | |
| 18 | fn attempt(binary: &Path, root: &Path, config: &Path, args: &[&str]) -> Result<Value> { |
| 19 | let output = Command::new(binary) |
| 20 | .current_dir(root) |
| 21 | .args(args) |
| 22 | .env("ATOMIC_SERVICE", "local") |
| 23 | .env("ATOMIC_RPC", "0") |
| 24 | .env("ATOMIC_CONFIG_DIR", config) |
| 25 | .env("ATOMIC_DAEMON_BIN", "/nonexistent/acceptance-no-daemon") |
| 26 | .env( |
| 27 | "ATOMIC_DAEMON_SOCKET", |
| 28 | "/nonexistent/acceptance-no-daemon.sock", |
| 29 | ) |
| 30 | .output()?; |
| 31 | Ok( |
| 32 | json!({"success":output.status.success(),"exit":output.status.code(),"stdout":String::from_utf8_lossy(&output.stdout),"stderr":String::from_utf8_lossy(&output.stderr)}), |
| 33 | ) |
| 34 | } |
| 35 | fn cli(binary: &Path, root: &Path, config: &Path, args: &[&str]) -> Result<Value> { |
| 36 | let result = attempt(binary, root, config, args)?; |
| 37 | if result["success"] != true { |