fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Nahorinit-unreadable-cwd.fish: replace custom check with `__fish_is_cygwin`240647327

master
814 B25 linesraw
1# RUN: fish=%fish %fish %s
2# Test that fish doesn't crash if cwd is unreadable at the start (#6597)
3
4set -l oldpwd $PWD
5set -l tmpdir (mktemp -d)
6
7# $fish might be a relative path (e.g. "../test/root/bin/fish")
8set -l fish (builtin realpath $fish)
9cd $tmpdir
10chmod 000 .
11# There's an error, but we don't really care about the specific one.
12$fish -c 'echo Look Ma! No crashing!' 2>/dev/null
13#CHECK: Look Ma! No crashing!
14
15# Verify fish reports the unreadable cwd on stderr instead of silently leaving cwd_fd unset.
16{
17    $fish -c 'true' 2>&1 1>/dev/null | string match -q '*Unable to open the current working directory*'
18    or __fish_is_cygwin
19}
20and echo "cwd error reported"
21#CHECK: cwd error reported
22
23# Careful here, Solaris' rm tests if the directory is in $PWD, so we need to cd back
24cd $oldpwd
25rmdir $tmpdir