Skip to content

Fix vers-client.sh issues #36

@AlephNotation

Description

@AlephNotation

Problems

Several issues in scripts/vers-client.sh need to be addressed:

1. Subshell variable scoping in vm-watch

The CURRENT_VM variable is modified inside a pipe subshell (the while loop piped from curl), so changes don't persist between iterations. This breaks the "print VM prefix only when switching VMs" logic.

# Line 348-376 - CURRENT_VM changes are lost each iteration
curl -sN "$url" | while IFS= read -r line; do
  ...
  CURRENT_VM="$vmId"  # This doesn't persist!
  ...
done

2. Same issue in watch/stream command

Similar subshell scoping issue if we wanted to track state.

3. pkill -P $$ curl may not work reliably

The run command uses pkill -P $$ curl to kill the curl process, which may not work on all systems or could kill unrelated curl processes.

Potential Fixes

  1. Use process substitution instead of pipes: while read line; do ...; done < <(curl -sN "$url")
  2. Use a named pipe (FIFO) for more control
  3. Track curl PID explicitly and kill by PID

🤖 Generated with Claude Code on VERS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions