Expand description
Which directory a command’s segments actually run in (GH #1661, #1662).
A tool call carries one cwd, but the command it runs may move: cd repo && grep -rn … . walks a tree the call never named, and cd "$SCRATCH" && curl -o shot.png … writes to a directory that is sanctioned for exactly that.
Judging either against the call’s cwd alone gets the answer wrong — too
lenient in the first case, too strict in the second.
Only a plain leading cd <literal> is followed. Anything the shell would
have to evaluate — a variable, a substitution, pushd, a subshell — leaves
the directory unknown, and an unknown directory is reported as such rather
than guessed at.
Structs§
- Segment
Cwd - One command segment together with the directory it runs in.
Functions§
- final_
cwd - The directory in effect once every segment has run.
- join_in
- Join
relunderbase, keeping a POSIX-rooted base POSIX. - segments_
with_ cwd - Split
commandinto segments, trackingcdas it goes.