Commit Graph
3 Commits
Author SHA1 Message Date
L4XB 8dedd4ceb3 fix(hooks): read << as a here-document only outside comments and arithmetic
A << in a comment (echo ok # <<EOF) or an identifier shift ($((x << n))) was read as a here-document opener, so the following lines, npm run dev included, were swallowed into its body. A comment now runs to the end of its line and an arithmetic expression is copied whole, so neither opens a here-document nor splits at an operator. A delimiter line ending in \r (CRLF) now ends the body too.
2026-10-23 02:01:04 +02:00
L4XB 2eee66a6c1 fix(hooks): split shell segments at newlines, keeping here-document bodies whole
splitShellSegments() split at &&, ||, ; and & but not at a newline, so a multi-line command such as "cd app\nnpm run dev" was one segment led by cd, and the dev-server block let the dev server through. A newline now ends a segment. The body of a here-document (<<EOF, <<-EOF, <<'EOF') stays in the segment of the command that reads it, so a README written with cat <<EOF that mentions npm run dev is not blocked; a here-string (<<<) or a shift such as $((x << 2)) is not read as one.
2026-10-23 01:45:20 +02:00
zzzhizhi 177dd36e23 fix(hooks): allow tmux-wrapped dev server commands (#321)
* fix(hooks): fix shell splitter redirection/escape bugs, extract shared module

- Fix single & incorrectly splitting redirection operators (&>, >&, 2>&1)
- Fix escaped quotes (\", \') not being handled inside quoted strings
- Extract splitShellSegments into shared scripts/lib/shell-split.js
  to eliminate duplication between hooks.json, before-shell-execution.js,
  and pre-bash-dev-server-block.js
- Add comprehensive tests for shell splitting edge cases

* fix(hooks): handle backslash escapes outside quotes in shell splitter

Escaped operators like \&& and \; outside quotes were still being
treated as separators. Add escape handling for unquoted context.
2026-03-07 14:47:49 -08:00