about summary refs log tree commit diff
path: root/tools
diff options
context:
space:
mode:
authorzseri <zseri.devel@ytrizja.de>2021-12-24T09·22+0100
committerzseri <zseri.devel@ytrizja.de>2021-12-25T05·19+0000
commit536f7c134a96b18a4771e33f9a1ba695f8fced5e (patch)
tree835301f8c227a0deb911f8fdf30553c1d414b72e /tools
parentd6b0aca7dd78a99f3167646b67849dce632aea46 (diff)
feat(depot-scanner): forward non-processed stderr output r/3388
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 <mail@tazj.in>
Diffstat (limited to 'tools')
-rw-r--r--tools/depot-scanner/main.go5
1 files changed, 5 insertions, 0 deletions
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 {