Resolve binaries in parent shell before tmux send-keys#5652
Open
samsondav wants to merge 1 commit into
Open
Conversation
If tmux is launched from one nix env and start-canton.sh or start-frontends.sh is later re-run from another nix env, the panes pick up the binary from the tmux server's inherited PATH (the first env) rather than the active env. This is silent and produces confusing debugging sessions. Resolve canton, toxiproxy-server, and npm via `command -v` in the parent shell and substitute the absolute path into the tmux command string so the pane invokes the binary directly regardless of the tmux server's PATH. If the binary is missing on PATH, fail fast in the parent shell with a clear message. The toxiproxy-server resolution happens just before its tmux invocation rather than at script start, so the script can still launch the canton session when only the canton/npm half of the environment is available. Fixes canton-network#458 Signed-off-by: Sam Davies <sam@avrofi.com>
e52abd8 to
342abcc
Compare
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.
Fixes #458.
Problem
If tmux is launched from one nix env and
start-canton.shorstart-frontends.shis later re-run from another nix env, the panes pick up the binary from the tmux server's inherited PATH (the first env) rather than the active env. The failure is silent and produces confusing debugging sessions, as flagged by @moritzkiefer-da on DACH-NY/canton-network-node#19787.Fix
Resolve
canton,toxiproxy-server, andnpmviacommand -vin the parent shell and substitute the absolute path into the tmux command string. The pane invokes the binary directly regardless of the tmux server's PATH.If the binary is missing on PATH, fail fast in the parent shell with a clear message before any tmux session is created, instead of failing silently inside a pane.
This matches the first idea from the issue body (resolve via
which, execute the result). The second idea (nix develop path:nixin every pane) is not used here because the issue notes a prior attempt made CI startup measurably slower.Scope
start-canton.sh:$CANTON(defaultcanton, overridable via-c) andtoxiproxy-server.start-frontends.sh:npm(used bystart_frontend,start_test, andwait_for_workspace_buildpanes).Out of scope:
teeand other coreutils — these were not the reported failure mode and are typically identical across nix envs.sbtandjq/jsonnetare invoked from the parent shell, not from a tmux pane, so they already pick up the active env's PATH.Behavior
command -v cantonreturns the same absolute path the pane would have resolved through PATH.start-canton.sh: 'canton' not found on PATH(or similar) before any tmux session is created.-c <custom-canton>with an absolute path: passes through unchanged viacommand -v.