fix: Disable interactive mode in exec by piping stdio (#230)#237
Merged
Conversation
Pipe stdin, stdout, and stderr when executing commands through gitopolis exec. This prevents commands from detecting a TTY and stops them from launching pagers, prompts, or other interactive features. Commands now run in a non-interactive environment where: - stdin is set to null (no input available) - stdout/stderr are piped and streamed line-by-line to the terminal This ensures git commands (and other CLI tools) won't pause for pagers or prompts that would hang the execution. Updated README.md to document the non-interactive behavior and its implications: - Git defaults to no-color (can re-enable with --color flag) - SSH/GPG keys must be pre-loaded in ssh-agent - Remote SSH hosts must be in known_hosts Applied to both repo_exec() and repo_exec_oneline() functions on both Unix and Windows platforms. Prompts: - any idea how to fix this [exec git log not turning off pager · Issue #230 · timabell/gitopolis](#230) - in response to: isn't that going to cause problems for cmd in windows? maybe only change if for unix builds - in response to: will empty string work? if so do that on all - in response to: is there a better way to tell git (and other cli commands) that it's non-interactive - in response to: can we make stdout not a tty? - in response to: that doesn't work, git is still paging with less. also give me a command i can use to test what other apps would generically be like - in response to: add a note to the readme that commands run with exec are not tty to avoid hanging due to prompts, note that git will then default to no-colour but it can be re-enabled with --color - in response to: add to that that this means you'll have to have your ssh/gpg keys already loaded and unlocked in ssh-agent or similar, and that remote ssh ids will need to already be accepted Fixes #230 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Windows test failed because new output streaming now normalizes crlf to lf. https://github.com/timabell/gitopolis/actions/runs/18809920700/job/53669470126?pr=237 Happy to keep it like that until it proves to be an actual problem.
Replaced escaped string literals with raw strings in both exec_with_special_chars and exec_with_multiple_tag_groups tests. This makes the test expectations much easier to read and maintain while preserving the same functionality. Prompts: - committed. now we can revert those test assertions back to normal raw strings for clarity - exec_with_multiple_tag_groups test needs doing too Co-Authored-By: Claude <noreply@anthropic.com>
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.
Pipe stdin, stdout, and stderr when executing commands through
gitopolis exec. This prevents commands from detecting a TTY and
stops them from launching pagers, prompts, or other interactive
features.
Commands now run in a non-interactive environment where:
This ensures git commands (and other CLI tools) won't pause for
pagers or prompts that would hang the execution.
Updated README.md to document the non-interactive behavior and its
implications:
Applied to both repo_exec() and repo_exec_oneline() functions on
both Unix and Windows platforms.
Prompts:
Fixes #230
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com