msys2 / msys2-pacman

A friendly fork of https://gitlab.archlinux.org/pacman/pacman
GNU General Public License v2.0
21 stars 12 forks source link

[UX] pacman -Syu core update discards bash history #31

Open Artoria2e5 opened 1 year ago

Artoria2e5 commented 1 year ago

Description / Steps to reproduce the issue

  1. Open a Window of MSYS2 MSYS
  2. Do anything to populate bash history
  3. Do pacman -Syu and make sure it's a core update
  4. Do the update
  5. 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

(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????

lazka commented 1 year ago

Yeah, that's not ideal right now, thanks

lazka commented 1 year ago

There are a few issues, open questions:

We could special case the parent processes of pacman somehow maybe?

Artoria2e5 commented 1 year ago

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?