From 3dc9930dbb74e9a13925a1ba02ed6b6628a5dd08 Mon Sep 17 00:00:00 2001 From: Sven van Heugten Date: Wed, 11 Mar 2026 22:46:10 +0100 Subject: [PATCH] Make `run` stream the output --- bin/git-check-assertions | 7 +++++-- default.nix | 3 +++ flake.nix | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/bin/git-check-assertions b/bin/git-check-assertions index 685b591..1195884 100755 --- a/bin/git-check-assertions +++ b/bin/git-check-assertions @@ -27,9 +27,12 @@ set -euo pipefail # helper functions inspired by bats/bats-assert run() { set +e - output="$("$@" 2>&1)" - status=$? + tmp_output="$(mktemp)" + "$@" 2>&1 | tee "$tmp_output" + status=${PIPESTATUS[0]} set -e + output="$(cat "$tmp_output")" + rm -f "$tmp_output" printf '%s\n' "$output" return 0 } diff --git a/default.nix b/default.nix index 4f9f1bd..c260e4c 100644 --- a/default.nix +++ b/default.nix @@ -10,6 +10,7 @@ resholve, shfmt, perl, + coreutils, }: let @@ -42,6 +43,7 @@ resholve.mkDerivation { gitMinimal shfmt perl + coreutils ]; checkPhase = '' @@ -69,6 +71,7 @@ resholve.mkDerivation { gnused bash perl + coreutils ]; execer = [ # Not true at all, but ¯\_(ツ)_/¯ diff --git a/flake.nix b/flake.nix index 06dda90..1fabe89 100644 --- a/flake.nix +++ b/flake.nix @@ -24,6 +24,7 @@ ])) pkgs.perl pkgs.shfmt + pkgs.coreutils ]; }; }