Skip to content

Instantly share code, notes, and snippets.

@BrainStone
Created October 11, 2022 15:12
Show Gist options
  • Save BrainStone/b682ef922bc3d92294e01d8b2220f5a0 to your computer and use it in GitHub Desktop.
Save BrainStone/b682ef922bc3d92294e01d8b2220f5a0 to your computer and use it in GitHub Desktop.
A simple script that fixes messed up terminal when sending SIGINT to scriptreplay
function scriptreplay () {
# Start a subshell to remove the trap in every case and to prevent the exit command from ending the parent shell
(
function _restore () {
# Reset terminal without losing scrollback
reset -I
# Exit subshell
exit
}
trap _restore SIGINT
# Call the original scriptreplay
command scriptreplay "$@"
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment