Repository navigation
fix: keep the terminal usable after upgrades and startup failures - #507
Open
Yaroslav Slepukhin (yslpn) wants to merge 1 commit into
Open
Yaroslav Slepukhin (yslpn) wants to merge 1 commit into
Yaroslav Slepukhin (yslpn) wants to merge 1 commit into
Conversation
After upgrading the binary, `is` exited with "resources out of date" and the shell plugin's trailing `exit` immediately closed the terminal tab, leaving no way to read the error or run `is reinit`. - refresh unpacked resources and shell plugins in place when their version doesn't match the binary, using atomic writes so tabs starting concurrently don't race and running sessions keep their loaded native module - actually overwrite stale files when unpacking (previously skipped) - on any startup or render failure, print the error and fall back to the plain shell (ISTERM=0 prevents the plugin from relaunching inshellisense) - only start inshellisense from the shell plugins when `is` is on PATH - resolve development resources relative to the entry point, not the cwd
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
After upgrading the binary (e.g.
brew upgrade inshellisense0.0.4 → 0.1.0), the unpacked resources still carried the oldversion.txt.isprintedinshellisense resources out of date, run "is reinit"and exited with code 1. The shell plugin (is -s zsh ; exit) then exited the parent shell, so new terminal tabs (e.g. Ghostty) closed immediately. The error could not be read andis reinitcould not be run from that terminal.There was a related bug:
copyAssets/copyFilesskipped files that already existed. As a result,is initafter an upgrade bumpedversion.txtbut kept stalepty.node,spawn-helperand shell integration scripts.Changes
root.ts,node.ts). Shell plugins and resources are regenerated at the current resource location. There is no legacy → XDG migration here; that is still done byis reinit.version.txtis written last so an interrupted refresh is retried.utils/file.ts). Each file is written to a temp file and renamed over the target. Files with identical content are skipped, and the replaced file's mode is preserved (spawn-helperstays executable). This avoids races when several tabs start at once after an upgrade, and running sessions keep the native module they already loaded.exitOverride) and pty spawn errors. The error and a hint are printed, then the user's shell is launched withISTERM=0. Any non-empty value stops existing plugins from relaunchingis, andisinside that shell can still retry. The shell's exit code is propagated. Executable and login-argument logic was moved togetShellExecutable/getShellLoginArgsinshell.tsand is shared withpty.ts, so the fallback path does not load node-pty.isis on PATH, so a missing binary does not close the terminal.is reinitis no longer required after upgrading.Testing
src/tests/utils/file.test.ts,src/tests/utils/node.test.ts, andgetShellLoginArgscases inshell.test.ts.npm run lintpasses.XDG_DATA_HOME:rc.toml: an error message is shown, then the plain zsh opens without relaunchingis..tmpfiles are left./tmp: works.ison PATH: the shell stays open.Not verified:
pty.nodethat is locked by a running session would fail to refresh and use the fallback path.Several existing suites (
config,ui,pty,runtime,suggestionManager…) fail to run locally with TS2307 module resolution errors. The same happens onmain.