From 7b57e286007569a4674ad50b17bb43cb6892c1f1 Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Wed, 4 Nov 2020 11:56:46 -0800 Subject: [PATCH] move localexec to common/shell-local dir since it is related to shelling out locally --- builder/amazon/common/ssm/session.go | 2 +- builder/docker/exec.go | 2 +- .../shell-local}/localexec/run_and_stream.go | 4 ++++ .../shell-local}/localexec/run_and_stream_test.go | 0 common/step_create_cdrom.go | 2 +- 5 files changed, 7 insertions(+), 3 deletions(-) rename {helper/builder => common/shell-local}/localexec/run_and_stream.go (90%) rename {helper/builder => common/shell-local}/localexec/run_and_stream_test.go (100%) diff --git a/builder/amazon/common/ssm/session.go b/builder/amazon/common/ssm/session.go index 2c90233e8..350c01ba4 100644 --- a/builder/amazon/common/ssm/session.go +++ b/builder/amazon/common/ssm/session.go @@ -14,7 +14,7 @@ import ( "github.com/aws/aws-sdk-go/service/ssm/ssmiface" "github.com/hashicorp/packer/builder/amazon/common/awserrors" "github.com/hashicorp/packer/common/retry" - "github.com/hashicorp/packer/helper/builder/localexec" + "github.com/hashicorp/packer/common/shell-local/localexec" "github.com/hashicorp/packer/packer" ) diff --git a/builder/docker/exec.go b/builder/docker/exec.go index e04461bb6..ee5a01efd 100644 --- a/builder/docker/exec.go +++ b/builder/docker/exec.go @@ -3,7 +3,7 @@ package docker import ( "os/exec" - "github.com/hashicorp/packer/helper/builder/localexec" + "github.com/hashicorp/packer/common/shell-local/localexec" "github.com/hashicorp/packer/packer" ) diff --git a/helper/builder/localexec/run_and_stream.go b/common/shell-local/localexec/run_and_stream.go similarity index 90% rename from helper/builder/localexec/run_and_stream.go rename to common/shell-local/localexec/run_and_stream.go index f40076cdb..9c598e608 100644 --- a/helper/builder/localexec/run_and_stream.go +++ b/common/shell-local/localexec/run_and_stream.go @@ -14,6 +14,10 @@ import ( "github.com/hashicorp/packer/packer" ) +// RunAndStream allows you to run a local command and stream output to the UI. +// This does not require use of a shell-local communicator, so is a nice tool +// for plugins that need to shell out to a local dependency and provide clear +// output to users. func RunAndStream(cmd *exec.Cmd, ui packer.Ui, sensitive []string) error { stdout_r, stdout_w := io.Pipe() stderr_r, stderr_w := io.Pipe() diff --git a/helper/builder/localexec/run_and_stream_test.go b/common/shell-local/localexec/run_and_stream_test.go similarity index 100% rename from helper/builder/localexec/run_and_stream_test.go rename to common/shell-local/localexec/run_and_stream_test.go diff --git a/common/step_create_cdrom.go b/common/step_create_cdrom.go index 3a350cce9..0f1c5664d 100644 --- a/common/step_create_cdrom.go +++ b/common/step_create_cdrom.go @@ -11,7 +11,7 @@ import ( "runtime" "strings" - "github.com/hashicorp/packer/helper/builder/localexec" + "github.com/hashicorp/packer/common/shell-local/localexec" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer/tmp"