s/b: write s/new as single write() to avoid partial-KV parse failure
Bash's printf builtin issues one write() syscall per call; the server processes each write independently, so the first write (name= only) would fail the cwd-required check. Build the full KV string first, then write once. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
b3e0367078
commit
00155f28fc
18
scripts/s/b
18
scripts/s/b
|
|
@ -77,13 +77,17 @@ fn_run_one() {
|
|||
local id=$1
|
||||
local B="$MOUNT/s/$id"
|
||||
|
||||
{
|
||||
printf 'name=%s\n' "$id"
|
||||
printf 'cwd=%s\n' "$cwd"
|
||||
[ -n "$agent" ] && printf 'agent=%s\n' "$agent"
|
||||
[ -n "$backend" ] && printf 'backend=%s\n' "$backend"
|
||||
[ -n "$model" ] && printf 'model=%s\n' "$model"
|
||||
} > "$MOUNT/s/new" || die "failed to create session"
|
||||
# Build as a single string: bash's printf builtin issues one write() per call;
|
||||
# the server processes each write independently, so partial KV would fail.
|
||||
local kv="name=${id}
|
||||
cwd=${cwd}"
|
||||
[ -n "$agent" ] && kv="${kv}
|
||||
agent=${agent}"
|
||||
[ -n "$backend" ] && kv="${kv}
|
||||
backend=${backend}"
|
||||
[ -n "$model" ] && kv="${kv}
|
||||
model=${model}"
|
||||
printf '%s\n' "$kv" > "$MOUNT/s/new" || die "failed to create session"
|
||||
|
||||
printf '%s\n' "$prompt" > "$B/prompt" || die "failed to submit prompt"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue