fix(shell): Use script command to fix pty errors on Termux#91
Open
estape11 wants to merge 1 commit intoNorthernTechHQ:mainfrom
Open
fix(shell): Use script command to fix pty errors on Termux#91estape11 wants to merge 1 commit intoNorthernTechHQ:mainfrom
estape11 wants to merge 1 commit intoNorthernTechHQ:mainfrom
Conversation
The `pty.Start` function was failing in the Termux environment, causing an "input/output error" when trying to read from the pseudo-terminal. This change wraps the shell command with the `script` utility, which provides a more robust way to create pseudo-terminals across different environments, resolving the issue on Termux. Signed-off-by: Esteban Agüero Pérez <esteban.aguero@northern.tech>
alfrunes
reviewed
Sep 10, 2025
Comment on lines
+64
to
+69
| log.Info("using script command to start shell") | ||
| cmd_wrapper := exec.Command("script", "-qec", shell, "/dev/null") | ||
| cmd_wrapper.SysProcAttr = cmd.SysProcAttr | ||
| cmd_wrapper.Dir = cmd.Dir | ||
| cmd_wrapper.Env = cmd.Env | ||
| cmd = cmd_wrapper |
Contributor
There was a problem hiding this comment.
This is discarding the initialization of the cmd above...
On the other hand, could this be solved by a simple config default change?
You could try adding the following to /etc/nt-connect/nt-connect.json:
{
"ShellCommand": "script",
"ShellArguments": ["-qec", "/bin/bash", "/dev/null"]
}
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.
The
pty.Startfunction was failing in the Termux environment, causing an "input/output error" when trying to read from the pseudo-terminal.This change wraps the shell command with the
scriptutility, which provides a more robust way to create pseudo-terminals across different environments, resolving the issue on Termux.