Skip to content

Commit

Permalink
disk: Pass /dev/null to containers.attach stdin
Browse files Browse the repository at this point in the history
When using os.Stdin, the initial ssh connection pipe is broken.

Signed-off-by: Chris Kyrouac <[email protected]>
  • Loading branch information
ckyrouac committed Jul 8, 2024
1 parent 70116ee commit d427434
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/bootc/bootc_disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,15 @@ func (p *BootcDisk) runInstallContainer(quiet bool, config DiskImageConfig) (err
attachCancelCtx, cancelAttach := context.WithCancel(p.Ctx)
defer cancelAttach()
var exitCode int32

nilFile, err := os.Open(os.DevNull)
if err != nil {
return fmt.Errorf("unable to open /dev/null: %w", err)
}

if !quiet {
attachOpts := new(containers.AttachOptions).WithStream(true)
if err := containers.Attach(attachCancelCtx, p.bootcInstallContainerId, os.Stdin, os.Stdout, os.Stderr, nil, attachOpts); err != nil {
if err := containers.Attach(attachCancelCtx, p.bootcInstallContainerId, nilFile, os.Stdout, os.Stderr, nil, attachOpts); err != nil {
return fmt.Errorf("attaching: %w", err)
}
}
Expand Down

0 comments on commit d427434

Please sign in to comment.