Skip to content

fix(shell-init): suppress cd output#437

Open
ajbw wants to merge 1 commit into
AikidoSec:mainfrom
ajbw:main
Open

fix(shell-init): suppress cd output#437
ajbw wants to merge 1 commit into
AikidoSec:mainfrom
ajbw:main

Conversation

@ajbw
Copy link
Copy Markdown

@ajbw ajbw commented Apr 28, 2026

If cd causes output on stdout (e.g., via the use of noisy chpwd hooks on zsh), then the resultant PATH exported to the shell will be polluted with that output, and safe-chain will not function. To prevent this, this PR updates init-posix.sh and unix-wrapper.template.sh to suppress any output on stdout during cd.

You can reproduce the original issue by configuring .zshrc as follows and launching a new shell:

PATH="/bin:/usr/bin:/usr/local/bin" # minimal PATH
myfunc() {
  echo "blah"
}
autoload -U add-zsh-hook
add-zsh-hook chpwd myfunc
set -x
source ~/.safe-chain/scripts/init-posix.sh # Safe-chain bash initialization script
set +x
Screenshot 2026-04-29 at 09 29 02

If `cd` causes output on stdout (e.g., via the use of noisy `chpwd` hooks on
zsh), then the resultant `PATH` exported to the shell will be polluted with that
output, and `safe-chain` will not function.  To prevent this, this PR updates
`init-posix.sh` and `unix-wrapper.template.sh` to suppress any output on stdout
during `cd`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant