File: D1565.test-bash-sigwinch.sh

package info (click to toggle)
ble.sh 0.4.0~git20250321.d4c812b-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 12,516 kB
  • sloc: sh: 71,367; awk: 1,316; cpp: 750; ansic: 186; javascript: 43; makefile: 35
file content (19 lines) | stat: -rw-r--r-- 352 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash

shopt -s checkwinsize

function trapwinch {
  local size=${COLUMNS}x${LINES}
  echo "WINCH-START ($size)"
  for i in {0..100}; do
    sleep 0.01
    local new_size=${COLUMNS}x${LINES}
    if [[ $new_size != "$size" ]]; then
      echo "SIZE CHANGED i=$i ($size)"
      size=$new_size
    fi
  done
  echo WINCH-END
}

trap trapwinch WINCH