golang 1.14 doesn't like calling NewFile on existing files. Port solution over from Terraform
This commit is contained in:
+2
-1
@@ -9,6 +9,7 @@ import (
|
||||
|
||||
"github.com/chzyer/readline"
|
||||
"github.com/hashicorp/packer/helper/wrappedreadline"
|
||||
"github.com/hashicorp/packer/helper/wrappedstreams"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
"github.com/hashicorp/packer/template"
|
||||
"github.com/hashicorp/packer/template/interpolate"
|
||||
@@ -115,7 +116,7 @@ func (*ConsoleCommand) AutocompleteFlags() complete.Flags {
|
||||
|
||||
func (c *ConsoleCommand) modePiped(session *REPLSession) int {
|
||||
var lastResult string
|
||||
scanner := bufio.NewScanner(wrappedreadline.Stdin())
|
||||
scanner := bufio.NewScanner(wrappedstreams.Stdin())
|
||||
for scanner.Scan() {
|
||||
result, err := session.Handle(strings.TrimSpace(scanner.Text()))
|
||||
if err != nil {
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
kvflag "github.com/hashicorp/packer/helper/flag-kv"
|
||||
sliceflag "github.com/hashicorp/packer/helper/flag-slice"
|
||||
"github.com/hashicorp/packer/helper/wrappedreadline"
|
||||
"github.com/hashicorp/packer/helper/wrappedstreams"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
"github.com/hashicorp/packer/template"
|
||||
)
|
||||
@@ -166,7 +166,7 @@ func (m *Meta) ValidateFlags() error {
|
||||
|
||||
// StdinPiped returns true if the input is piped.
|
||||
func (m *Meta) StdinPiped() bool {
|
||||
fi, err := wrappedreadline.Stdin().Stat()
|
||||
fi, err := wrappedstreams.Stdin().Stat()
|
||||
if err != nil {
|
||||
// If there is an error, let's just say its not piped
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user