summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/hashicorp/go-sockaddr/cmd/sockaddr/vendor/github.com/mitchellh/cli/ui_concurrent.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/hashicorp/go-sockaddr/cmd/sockaddr/vendor/github.com/mitchellh/cli/ui_concurrent.go')
-rw-r--r--vendor/github.com/hashicorp/go-sockaddr/cmd/sockaddr/vendor/github.com/mitchellh/cli/ui_concurrent.go54
1 files changed, 54 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/go-sockaddr/cmd/sockaddr/vendor/github.com/mitchellh/cli/ui_concurrent.go b/vendor/github.com/hashicorp/go-sockaddr/cmd/sockaddr/vendor/github.com/mitchellh/cli/ui_concurrent.go
new file mode 100644
index 000000000..b4f4dbfaa
--- /dev/null
+++ b/vendor/github.com/hashicorp/go-sockaddr/cmd/sockaddr/vendor/github.com/mitchellh/cli/ui_concurrent.go
@@ -0,0 +1,54 @@
+package cli
+
+import (
+ "sync"
+)
+
+// ConcurrentUi is a wrapper around a Ui interface (and implements that
+// interface) making the underlying Ui concurrency safe.
+type ConcurrentUi struct {
+ Ui Ui
+ l sync.Mutex
+}
+
+func (u *ConcurrentUi) Ask(query string) (string, error) {
+ u.l.Lock()
+ defer u.l.Unlock()
+
+ return u.Ui.Ask(query)
+}
+
+func (u *ConcurrentUi) AskSecret(query string) (string, error) {
+ u.l.Lock()
+ defer u.l.Unlock()
+
+ return u.Ui.AskSecret(query)
+}
+
+func (u *ConcurrentUi) Error(message string) {
+ u.l.Lock()
+ defer u.l.Unlock()
+
+ u.Ui.Error(message)
+}
+
+func (u *ConcurrentUi) Info(message string) {
+ u.l.Lock()
+ defer u.l.Unlock()
+
+ u.Ui.Info(message)
+}
+
+func (u *ConcurrentUi) Output(message string) {
+ u.l.Lock()
+ defer u.l.Unlock()
+
+ u.Ui.Output(message)
+}
+
+func (u *ConcurrentUi) Warn(message string) {
+ u.l.Lock()
+ defer u.l.Unlock()
+
+ u.Ui.Warn(message)
+}