fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
440e7fcbc
master
1#RUN: %fish %s 2 3ulimit --core-size 4#CHECK: {{unlimited|\d+}} 5ulimit --core-size0 6ulimit --core-size 7#CHECK: 0 8 9ulimit 4352353252352352334 10#CHECKERR: ulimit: Invalid limit '4352353252352352334' 11#CHECKERR: 12#CHECKERR: {{.*}}checks/ulimit.fish (line {{\d+}}): 13#CHECKERR: ulimit 4352353252352352334 14#CHECKERR: ^ 15#CHECKERR: (Type 'help ulimit' for related documentation) 16 17# Try to increase a hard limit 18# Since limits vary between OSes and distributions, we need to find 19# a non-unlimited dynamically 20set -l ulimit_opts -c -d -f -n -s -t -u 21for ulimit_optin $ulimit_opts 22set -l max( ulimit -H$ulimit_opt 2> /dev/null) 23if contains --" $max " "" unlimited 24continue 25end 26set found true 27echo "Using $ulimit_opt to increase hard limit" >&2 28ulimit -H$ulimit_opt ( math $max +1 ) > /dev/null 29and if __fish_is_cygwin 30echo "ulimit: Permission denied when changing resource of type 'Fake result for Cygwin'" >&2 31end 32break 33end 34if not set -q found 35echo "All common hard ulimits are unlimited, cannot increase them" >&2 36end 37#CHECKERR: Using {{-.}} to increase hard limit 38#CHECKERR: ulimit: Permission denied when changing resource of type '{{.+}}' 39 40# Try to lower a hard limit below its soft one 41set -e found 42for ulimit_optin $ulimit_opts 43set -l min( ulimit -S$ulimit_opt 2> /dev/null) 44if contains --" $min " "" 0 45continue 46end 47if test $min = unlimited 48set min1024 49end 50set found true 51echo "Using $ulimit_opt to lower hard limit" >&2 52ulimit -H$ulimit_opt ( math $min -1 ) > /dev/null 53and if test ( __fish_uname ) = FreeBSD 54echo "ulimit: FreeBSD doesn't fail unlike other platforms, so fake it" >&2 55end 56break 57end 58if not set -q found 59echo "All common soft ulimits are 0, cannot decrease hard ulimits below them" >&2 60end 61#CHECKERR: Using {{-.}} to lower hard limit 62#CHECKERR: ulimit: {{.+}} 63 64if test ( __fish_uname ) = Linux 65ulimit -K1024 66else 67ulimit -q1024 68end 69#CHECKERR: ulimit: Resource limit not available on this operating system 70#CHECKERR: {{.*}}checks/ulimit.fish (line {{\d+}}): 71#CHECKERR: ulimit -{{.}} 1024 72#CHECKERR: ^ 73#CHECKERR: (Type 'help ulimit' for related documentation) 74 75ulimit --core-size0 1 2 76#CHECKERR: ulimit: too many arguments 77#CHECKERR: {{.*}}checks/ulimit.fish (line {{\d+}}): 78#CHECKERR: ulimit --core-size 0 1 2 79#CHECKERR: ^ 80#CHECKERR: (Type 'help ulimit' for related documentation) 81 82ulimit --core-size abc 83#CHECKERR: ulimit: Invalid limit 'abc' 84#CHECKERR: {{.*}}checks/ulimit.fish (line {{\d+}}): 85#CHECKERR: ulimit --core-size abc 86#CHECKERR: ^ 87#CHECKERR: (Type 'help ulimit' for related documentation)