Created
October 11, 2022 15:12
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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