Skip to content

Hook stdout breaks rift shell-init directory switching #32

Description

@gpu004

What I observed

Output from a successful postcreate hook is mixed into the path consumed by the zsh shell wrapper, so the wrapper cannot enter the created rift.

Reproduction

cargo build --locked
probe=$(mktemp -d /tmp/rift-hook-stdout.XXXXXX)
mkdir -p "$probe/source" "$probe/home"
cat > "$probe/source/.rift.toml" <<'TOML'
version = 1
[[hooks.postcreate]]
run = "printf hook-output"
TOML

RIFT_BIN="$PWD/target/debug/rift" PROBE="$probe" HOME="$probe/home" zsh -f <<'ZSH'
eval "$("$RIFT_BIN" shell-init zsh)"
rift init --here "$PROBE/source"
cd "$PROBE/source"
printf 'before=%s\n' "$PWD"
rift create --name child
printf 'status=%s after=%s\n' "$?" "$PWD"
ZSH

The wrapper exits 1 and leaves the shell in the source directory. Its error contains a combined hook-output and destination path:

rift:cd:6: no such file or directory: hook-output/private/tmp/.../.rifts/source/child

The child exists and the registry has both rows.

Expected

Hook stdout does not alter the path used by shell integration, and the wrapper enters the created child.

Actual

Hook stdout prefixes the destination path. The cd fails after creation has committed.

Environment

  • Rift commit 757a22cb247f
  • zsh on macOS 26.6.2, arm64, APFS

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions