moby / moby/hyperkit

Hyperkit's go api could not create console on stdio.

Open
#325 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
3.7k
Forks
336
PR merge metrics
No merged PRs in 30d

Description

Could not create console on stdio with ConsoleStdio or StdioInteractiveConsole

Case 1. StdioInteractiveConsole

If I set the value of Serial.InteractiveConsole to StdioInteractiveConsole to create console on stdio, it return an error:
If StdioInteractiveConsole is set, stdio must be a TTY.

Unlike the description of the error, this error occurs when isTerminal() condition returns true. That is, although stdio is a tty, error occurs.

if isTerminal(os.Stdout) {
  return errors.New("If StdioInteractiveConsole is set, stdio must be a TTY")
}
Case 2. ConsoleStdio

If I set the value of Hyperkit.Console (without Serial) field to ConsoleStdio and call run(), an error occurs: exec: Stdout already set.

With stdio console, cmd.Stdout is set to os.Stdout (cmd.Stdout = os.Stdout). But the next line, cmd.StdoutPipe() method is called and the method return error when cmd.Stdout is not nil.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the Go API paths for StdioInteractiveConsole and ConsoleStdio into run(), then inspect the isTerminal(os.Stdout) check and the subsequent StdoutPipe() call. Reproduce both cases with stdio attached to a TTY and confirm that the TTY case no longer returns the incorrect error and ConsoleStdio no longer reports "exec: Stdout already set."

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.