Skip to content

fix(shell-local): avoid ETXTBSY for inline scripts#341

Open
tanmay-hc wants to merge 1 commit into
mainfrom
fix-ETXTBSY
Open

fix(shell-local): avoid ETXTBSY for inline scripts#341
tanmay-hc wants to merge 1 commit into
mainfrom
fix-ETXTBSY

Conversation

@tanmay-hc

Copy link
Copy Markdown
Contributor

Summary

Update the default Unix execution path for generated shell-local inline scripts to invoke the configured inline_shebang interpreter instead of executing the temporary script directly.

Linux can reject direct execution with ETXTBSY (Text file busy) when the script is briefly held open for writing by the filesystem or another process. Invoking the interpreter causes it to read the script instead, avoiding that executable-file restriction.

Compatibility

  • Preserves custom execute_command values.
  • Preserves the configured inline_shebang and its arguments.
  • Keeps the existing direct execution behavior for user-supplied script and scripts.
  • Leaves Windows behavior unchanged.

@tanmay-hc
tanmay-hc requested a review from a team as a code owner July 15, 2026 08:25
@anurag5sh
anurag5sh requested a review from Copilot July 15, 2026 09:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates shell-local’s default Unix execution flow for generated inline scripts to avoid ETXTBSY by invoking the configured inline_shebang interpreter to read the temp script rather than executing the temp script directly.

Changes:

  • Adjusts Validate to choose a different default execute_command on Unix when Inline/Command is used, invoking inline_shebang with the script path passed as $0.
  • Adds unit tests validating the default execute_command selection across config modes (inline/command/script/custom).
  • Adds an integration-style communicator test that runs an inline script while the script file is still open for writing.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
shell-local/config.go Changes default Unix execute_command for inline/command to run via inline_shebang interpreter to avoid ETXTBSY.
shell-local/config_test.go Adds table-driven coverage for Validate default execute_command behavior.
shell-local/communicator_test.go Adds regression test ensuring inline execution works when the script file remains open for writing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread shell-local/config.go
Comment on lines +131 to +135
config.ExecuteCommand = []string{
"/bin/sh",
"-c",
"{{.Vars}} {{.Script}}",
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants