msys2-pacman
msys2-pacman copied to clipboard
[UX] pacman -Syu core update discards bash history
Description / Steps to reproduce the issue
- Open a Window of MSYS2 MSYS
- Do anything to populate bash history
- Do
pacman -Syu
and make sure it's a core update - Do the update
- Re-open the window
Expected behavior
I expect the history to be preserved, like with a normal close.
Actual behavior
The close is forced (for good reason) and no history is saved from the session.
Verification
- [X] I have verified that my MSYS2 is up-to-date before submitting the report (see https://www.msys2.org/docs/updating/)
(but you need to wait until it's outdated to reproduce it! oh or just make a fake update tarball.)
Windows Version
MSYS_NT-10.0-22624
Are you willing to submit a PR?
Yes, if we figure out the best way. A possible way is putting this in the default bashrc, but I am not sure it's "graceful" enough (what if it's not a core update? that would change behavior!). It also needs to cover other shells and so on.
pacman() {
history -a;
command pacman "$@";
}
Or maybe we make kill_all_other_msys_processes()
do a normal sigterm in the MSYS2 context before the taskkill????
Yeah, that's not ideal right now, thanks
There are a few issues, open questions:
- bash ignores SIGTERM, so that doesn't work
- bash allows SIGHUP though (is that a good idea?)
- Does killing bash kill pacman running in it as well? Otherwise we don't get a chance of sending SIGKILL.
We could special case the parent processes of pacman somehow maybe?
Does killing bash kill pacman running in it as well
Ho, that's a good one! SIGHUP probably does that. I guess pacman
can add a signal (SIGHUP, SIG_IGN);
in the core upgrade bit?