Skip to content

Commit

Permalink
move termios cludge to 'package main'
Browse files Browse the repository at this point in the history
no need to execute this all the time during tests

Signed-off-by: Alex Suraci <suraci.alex@gmail.com>
  • Loading branch information
vito committed Aug 22, 2019
1 parent 317d861 commit 4fd09a9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
13 changes: 13 additions & 0 deletions cmd/builder-task/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

task "github.com/concourse/builder-task"
"github.com/sirupsen/logrus"
"github.com/u-root/u-root/pkg/termios"
)

func main() {
Expand All @@ -16,6 +17,18 @@ func main() {
wd, err := os.Getwd()
failIf("get root path", err)

// limit max columns; Concourse sets a super high value and buildctl happily
// fills the whole screen with whitespace
ws, err := termios.GetWinSize(os.Stdout.Fd())
if err == nil {
ws.Col = 100

err = termios.SetWinSize(os.Stdout.Fd(), ws)
if err != nil {
logrus.Warn("failed to set window size:", err)
}
}

res, err := task.Build(wd, req)
failIf("failed to build", err)

Expand Down
15 changes: 1 addition & 14 deletions task.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/u-root/u-root/pkg/termios"
)

func Build(rootPath string, req Request) (Response, error) {
Expand All @@ -36,19 +35,7 @@ func Build(rootPath string, req Request) (Response, error) {
Outputs: []string{"image", "cache"},
}

// limit max columns; Concourse sets a super high value and buildctl happily
// fills the whole screen with whitespace
ws, err := termios.GetWinSize(os.Stdout.Fd())
if err == nil {
ws.Col = 80

err = termios.SetWinSize(os.Stdout.Fd(), ws)
if err != nil {
logrus.Warn("failed to set window size:", err)
}
}

err = os.MkdirAll(cacheDir, 0755)
err := os.MkdirAll(cacheDir, 0755)
if err != nil {
return Response{}, errors.Wrap(err, "create image output folder")
}
Expand Down

0 comments on commit 4fd09a9

Please sign in to comment.