OILS / spec / stateful / sigwinch-bug.sh View on Github | oilshell.org

60 lines, 19 significant
1#!/usr/bin/env bash
2#
3# Usage:
4# demo/sigwinch-bug.sh <function name>
5#
6# Related: demo/signal-during-read.sh
7
8set -o nounset
9set -o pipefail
10set -o errexit
11
12# TODO:
13# - Catalog all the "slow" syscalls?
14# - read() and wait() are definitely there.
15# - And write(), but that appears to be handled at the Python level.
16# - Catalog all the cases where CPython handles EINTR
17# - e.g. sys.stdout.write() ?
18# - see demo/cpython-signals.sh
19
20# More test cases:
21# https://github.com/oilshell/oil/wiki/Testing-the-Interactive-Shell
22
23
24# Can also use the app bundle
25OSH=bin/osh
26#OSH=osh
27
28
29# BUG: Try resizing terminal here.
30# Different bug: OSH requires you to hit Ctrl-C then ENTER when running this?
31case-read() {
32 $OSH -i -c 'read'
33}
34
35# BUG: Try resizing terminal here.
36case-read-n() {
37 $OSH -i -c 'read -n 5'
38}
39
40# BUG: Try resizing terminal here.
41# Hm not reproducible with $OSH -i? Have to do it at the prompt?
42# I guess this has to do with GNU readline?
43pipeline() {
44 $OSH -i -c 'sleep 5 | wc -l'
45}
46
47# BUG: Try resizing terminal here.
48command-sub() {
49 $OSH -i -c 'echo $(sleep 5; echo hi)'
50}
51
52# There is no bug, so it appears sys.stdout.write() handle EINTR? It's a
53# higher-level interface than posix.read().
54write() {
55
56 # The shell will be blocked on a write.
57 $OSH -i -c 'for i in {1..1000}; do echo "[$i]"; done | sleep 5;'
58}
59
60"$@"