Repository navigation
Conversation
A fork is otherwise named after the directory and the first number not taken, turso.1, which says nothing about what it is for. With -n swebench, it is turso.swebench, and its base .turso.swebench.base, so that forks made for different things can be told apart, and a script can know where its fork is without parsing fsfork's output. A named fork takes no number. The name cannot be empty or have / in it, as the fork goes next to the directory, and cannot be given with a second argument, which says where the fork goes instead. In confine, it cannot be given with -d, which runs the command without a fork.
penberg
added a commit
that referenced
this pull request
Nov 3, 2026
…not (#7) `fsfork` on a terminal printed a path and left you where you were. A process cannot change its parent's working directory, so now it starts your shell in the fork instead, as `confine` does with no command: ```sh $ fsfork # stdin and stdout are terminals fsfork: forked to /Users/you/src/turso.1, exit to come back $ exit # back in ~/src/turso, and the fork stays $ cd $(fsfork) # stdout is captured: prints the path, as before $ fsfork --print # always prints the path ``` - **Stdin has to be a terminal too.** Otherwise the shell would run what it reads from there as commands, such as the remaining lines in `... | while read dir; do fsfork "$dir"; done`. - **`--print` is for scripts.** A script run from a terminal is on that terminal too, and would stall in a shell if it does not capture the path. - **Exit status.** On a terminal, it is the shell's. If the shell cannot be run, the fork and base are removed and the status is 1. - **New tabs open in the fork.** Ghostty sets up its shell integration only in the shell it starts, so the shell `fsfork` starts never reports its directory with OSC 7, and a new tab opened while working in the fork, as in Claude Code, opened in the directory forked. `fsfork` now reports the fork with OSC 7 before it becomes the shell, and sets `PWD` to it. The outer shell reports its own directory again once the shell exits. Rebased on `main`, so it works with `-n` from #8. ## Not done `demo.tape` now uses `fsfork --print wordfreq`, so the demo's later commands still run from the parent directory, but `demo.gif` and `demo.mp4` are not re-recorded and still show `fsfork wordfreq`. `confine` running a command in a fork has the same problem with new tabs, and is not changed here. ## Testing `cargo test` and `cargo clippy` pass on macOS. The new tests run `fsfork` on a pseudo-terminal with commands typed to a real `/bin/sh`, covering all three ways of getting the path, the shell's directory, `PWD` and exit status, the OSC 7 sent to the terminal, and the failure to run a shell. CI covers Linux. The new-tab fix has not been tried in Ghostty itself.
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.
A fork is otherwise named after the directory and the first number not taken,
turso.1, which says nothing about what it is for. With-n swebench, it isturso.swebench, and its base.turso.swebench.base, so that forks made for different things can be told apart, and a script can know where its fork is without parsingfsfork's output. A named fork takes no number.The name cannot be empty or have
/in it, as the fork goes next to the directory, and cannot be given with a second argument, which says where the fork goes instead. Inconfine, it cannot be given with-d, which runs the command without a fork.Stacked on #6, as it builds on
Contentsand--no-ignorefrom there.