From 536f7c134a96b18a4771e33f9a1ba695f8fced5e Mon Sep 17 00:00:00 2001 From: zseri Date: Fri, 24 Dec 2021 10:22:51 +0100 Subject: feat(depot-scanner): forward non-processed stderr output previously, depot-scanner swallowed/ignored all non-processed stderr output of nix-instantiate, which makes diagnosing failures of nix-instantiate (e.g. failed with exit status 1) difficult. This commit fixes that by always forwarding the remaining stderr messages. Example previous error message: panic: nix-instantiate failed: exit status 1 goroutine 1 [running]: main.main() /nix/store/8vb2j13bd7j5ipl7dhsnwvgr7nrrsqsi-main.go:160 +0xeb4 Example new error message: nix-inst> error: unrecognised flag '--trace-file-access' nix-inst> Try '/run/current-system/sw/bin/nix-instantiate --help' for more information. panic: nix-instantiate failed: exit status 1 goroutine 1 [running]: main.main() /nix/store/qy7v79a3harddirzmc0432vbzqhyf91i-main.go:165 +0xeb4 Change-Id: I666f3490fc648f77a5384b95edd74f6115f7920d Reviewed-on: https://cl.tvl.fyi/c/depot/+/4553 Tested-by: BuildkiteCI Reviewed-by: tazjin --- tools/depot-scanner/main.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tools') diff --git a/tools/depot-scanner/main.go b/tools/depot-scanner/main.go index 4128fce187f0..9171587be2b9 100644 --- a/tools/depot-scanner/main.go +++ b/tools/depot-scanner/main.go @@ -94,6 +94,11 @@ func consumeOutput(stdout, stderr io.ReadCloser) (map[fileScanType]map[string]st line := scanner.Text() if strings.HasPrefix(line, depotTraceString) { addPath(strings.TrimPrefix(line, depotTraceString), result) + } else { + // print remaining stderr output of nix-instantiate + // to prevent silent swallowing of possible important + // error messages (e.g. about command line interface changes) + fmt.Fprintf(os.Stderr, "nix-inst> %s\n", line) } } if scanner.Err() != nil { -- cgit 1.4.1