Closes #44003 Supersedes https://github.com/zed-industries/zed/pull/45777 Co-authored-by: Lukas <lukas@zed.dev> Release Notes: - Fixed an issue where the terminal would sometimes fail to write shell history. --------- Co-authored-by: Lukas Wirth <me@lukaswirth.dev>