Skip to content

Commit

Permalink
fallback configuration, randomized entrypoint location and general fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
oclaussen committed Apr 13, 2018
1 parent c528b57 commit e15b401
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
4 changes: 2 additions & 2 deletions pkg/container/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ func createContainer(ctx context.Context, options Options) (string, error) {

func getEntrypoint(options Options) []string {
entrypoint := []string{"/bin/sh"}
if len(options.Interpreter) > 0 {
if options.Interpreter != nil {
entrypoint = options.Interpreter
}
if !options.Interactive {
if !options.Interactive && len(options.Script) > 0 {
entrypoint = append(entrypoint, options.Entrypoint)
}
return entrypoint
Expand Down
5 changes: 1 addition & 4 deletions pkg/container/entrypoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,5 @@ func uploadEntrypoint(
return err
}
_, err = tarWriter.Write([]byte(options.Script))
if err != nil {
return err
}
return nil
return err
}
8 changes: 4 additions & 4 deletions pkg/container/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ func streamContainer(
return
}
defer func() {
if err := term.RestoreTerminal(inFd, inState); err != nil {
log.Error(err)
if restErr := term.RestoreTerminal(inFd, inState); err != nil {
log.Error(restErr)
}
}()

Expand All @@ -86,8 +86,8 @@ func streamContainer(
return
}
defer func() {
if err := term.RestoreTerminal(outFd, outState); err != nil {
log.Error(err)
if restErr := term.RestoreTerminal(outFd, outState); err != nil {
log.Error(restErr)
}
}()

Expand Down
4 changes: 2 additions & 2 deletions pkg/image/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ func Get(ctx context.Context, options Options) (string, error) {
return name, nil
} else if options.Build != nil {
if options.Name != "" {
log.Info(fmt.Sprintf("Image %s not found, building...", name))
log.Info(fmt.Sprintf("Image %s not found, building...", options.Name))
} else {
log.Info("Building image...")
}
return build(ctx, options)
} else if options.Name != "" {
log.Info(fmt.Sprintf("Image %s not found locally, pulling...", name))
log.Info(fmt.Sprintf("Image %s not found locally, pulling...", options.Name))
return pull(ctx, options)
} else {
return "", errors.New("you need to specify either image name or build")
Expand Down

0 comments on commit e15b401

Please sign in to comment.