Skip to content

fix: Executor arguments getting ignored#2176

Merged
RohitKushvaha01 merged 2 commits into
mainfrom
RohitKushvaha01-patch-1
Jun 10, 2026
Merged

fix: Executor arguments getting ignored#2176
RohitKushvaha01 merged 2 commits into
mainfrom
RohitKushvaha01-patch-1

Conversation

@RohitKushvaha01

Copy link
Copy Markdown
Member

No description provided.

@greptile-apps

greptile-apps Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a bug where commands passed to the Alpine init script by the Executor component were silently ignored — the script would run all of its initialization logic and then exit without ever running the requested command. The fix inserts an early exec "$@" block after flag parsing that hands off to the caller's command immediately (when not in --installing mode).

  • Adds a guard at line 32 that fires exec "$@" when remaining positional arguments exist, INSTALLING is not set, and $1 does not start with --; this correctly short-circuits the lengthy init/setup code for the executor use case.
  • Removes a stray blank line around the chmod +x "$PREFIX/alpine/initrc" call — cosmetic only, no behavioral change.

Confidence Score: 5/5

Safe to merge — the exec short-circuit is the right approach for passing through executor commands, and it only fires in well-scoped conditions (no INSTALLING flag, args present, first arg not a --prefixed token).

The change is narrow and targeted: it adds a single early-exit exec path and a cosmetic blank-line fix. The exec guard correctly exempts the installation path, and the common invocation patterns all behave as expected. The only gap is the -- sentinel interaction flagged as a comment, which is unlikely to be hit in practice by any current caller.

No files require special attention beyond the exec guard condition in src/plugins/terminal/scripts/init-alpine.sh.

Important Files Changed

Filename Overview
src/plugins/terminal/scripts/init-alpine.sh Adds an early exec "$@" block to pass through executor-supplied commands before the Alpine initialization code runs; also removes a stray blank line around chmod. The core logic is sound for the common case, but a guard condition has a subtle gap with the -- flag-terminator sentinel.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[init-alpine.sh called] --> B[Parse flags in while loop]
    B --> C{Recognized flag?}
    C -->|--installing| D[INSTALLING=true, shift]
    C -->|--failsafe| E[FAILSAFE=true, shift]
    C -->|--| F[shift, break]
    C -->|other / unknown| G[break, keep $1]
    D --> B
    E --> B
    F --> H
    G --> H
    H{INSTALLING != true AND $# > 0 AND $1 not --prefixed?}
    H -->|YES| I[exec $@ - NEW: hands off to caller's command]
    H -->|NO| J[Continue init script]
    I --> Z[Process replaced - script exits]
    J --> K[Install missing packages]
    K --> L{INSTALLING = true?}
    L -->|YES| M[Configure timezone, setup .bashrc, exit 0]
    L -->|NO| N[Setup motd, acode CLI, initrc]
    N --> O{FAILSAFE != true?}
    O -->|YES| P[Launch bash terminal via axs]
    O -->|NO| Q[Exit without launching terminal]
Loading

Reviews (2): Last reviewed commit: "Update init-alpine.sh" | Re-trigger Greptile

Comment thread src/plugins/terminal/scripts/init-alpine.sh
@RohitKushvaha01

Copy link
Copy Markdown
Member Author

@greptileai

@RohitKushvaha01 RohitKushvaha01 merged commit eb725a4 into main Jun 10, 2026
10 checks passed
@RohitKushvaha01 RohitKushvaha01 deleted the RohitKushvaha01-patch-1 branch June 10, 2026 10:21
@bajrangCoder bajrangCoder mentioned this pull request Jun 10, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant