diff --git a/bin/gstack-hook-check b/bin/gstack-hook-check index ca9727f12..00e35125a 100755 --- a/bin/gstack-hook-check +++ b/bin/gstack-hook-check @@ -51,7 +51,9 @@ if [ -z "$ROOT" ] || [ ! -d "$ROOT" ]; then echo "usage: gstack-hook-check [--setup ] [--list] " >&2 exit 2 fi -case "$ROOT" in /*) ;; *) ROOT="$PWD/$ROOT" ;; esac +# A Windows path (D:\x or D:/x) from a native caller: use Git Bash's spelling. +case "$ROOT" in [A-Za-z]:[\\/]*) command -v cygpath >/dev/null 2>&1 && ROOT=$(cygpath -u "$ROOT") ;; esac +case "$ROOT" in /*|[A-Za-z]:[\\/]*) ;; *) ROOT="$PWD/$ROOT" ;; esac [ "$ROOT" = / ] || ROOT=${ROOT%/} SETUP_FILE="${SETUP_FILE:-$ROOT/setup}" diff --git a/test/gstack-doctor.test.ts b/test/gstack-doctor.test.ts index c1d2ea3ab..c389a9b77 100644 --- a/test/gstack-doctor.test.ts +++ b/test/gstack-doctor.test.ts @@ -81,7 +81,9 @@ function makeFixture(): Fixture { ' *) exit 64 ;;', 'esac', ]); - const hooks = spawnSync('bash', [path.join(root, 'bin/gstack-hook-check'), '--list', root], { encoding: 'utf8', timeout: 20_000 }).stdout.trim().split('\n'); + const listed = spawnSync('bash', [path.join(root, 'bin/gstack-hook-check'), '--list', root], { encoding: 'utf8', timeout: 20_000 }); + const hooks = listed.stdout.split('\n').map(line => line.trim()).filter(Boolean); + if (!hooks.includes('autoplan/bin/phase-publication-hook')) throw new Error(`gstack-hook-check --list missed the autoplan hook: ${listed.stdout}${listed.stderr}`); for (const hook of hooks) write(path.join(root, hook), '#!/bin/sh\nexit 0\n', 0o755); // The doctor launches each compiled binary's --version (#2595), so the // stand-ins answer it like the real binaries do.