fish-shell/tests/checks/init-unreadable-cwd.fish
Fabian Homborg fdda090aa1 parser: Stop crashing when cwd isn't readable
Everything seems to be working, so instead of crashing just print an
error and return.

Fixes #6597

(cherry picked from commit ceba851d44)
2020-02-22 23:30:48 +08:00

18 lines
536 B
Fish

#RUN: %fish -C 'set -g fish %fish' %s
# Test that fish doesn't crash if cwd is unreadable at the start (#6597)
set -l oldpwd $PWD
set -l tmpdir (mktemp -d)
# $fish might be a relative path (e.g. "../test/root/bin/fish")
set -l fish (builtin realpath $fish)
cd $tmpdir
chmod 000 .
$fish -c 'echo Look Ma! No crashing!'
#CHECK: Look Ma! No crashing!
#CHECKERR: Unable to open the current working directory: Permission denied
# Careful here, Solaris' rm tests if the directory is in $PWD, so we need to cd back
cd $oldpwd
rmdir $tmpdir