diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 000000000..13566b81b
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/compose.iml b/.idea/compose.iml
new file mode 100644
index 000000000..5e764c4f0
--- /dev/null
+++ b/.idea/compose.iml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/golinter.xml b/.idea/golinter.xml
new file mode 100644
index 000000000..1ccf3ec6d
--- /dev/null
+++ b/.idea/golinter.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/material_theme_project_new.xml b/.idea/material_theme_project_new.xml
new file mode 100644
index 000000000..b1a83ad35
--- /dev/null
+++ b/.idea/material_theme_project_new.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 000000000..2efec7ef0
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 000000000..35eb1ddfb
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/cmd/display/tty.go b/cmd/display/tty.go
index 0726ce270..39e5fc946 100644
--- a/cmd/display/tty.go
+++ b/cmd/display/tty.go
@@ -176,13 +176,13 @@ func (w *ttyWriter) Start(ctx context.Context, operation string) {
func (w *ttyWriter) Done(operation string, success bool) {
w.print()
+ w.done <- true
w.mtx.Lock()
defer w.mtx.Unlock()
if w.ticker != nil {
w.ticker.Stop()
}
w.operation = ""
- w.done <- true
}
func (w *ttyWriter) On(events ...api.Resource) {
diff --git a/cmd/display/tty_test.go b/cmd/display/tty_test.go
index 0bbd35f2a..f6a1a66a9 100644
--- a/cmd/display/tty_test.go
+++ b/cmd/display/tty_test.go
@@ -18,6 +18,7 @@ package display
import (
"bytes"
+ "context"
"strings"
"sync"
"testing"
@@ -422,3 +423,23 @@ func TestLenAnsi(t *testing.T) {
})
}
}
+
+func TestDoneDeadlockFix(t *testing.T) {
+ w, _ := newTestWriter()
+ addTask(w, "test-task", "Working", "details", api.Working)
+ ctx, cancel := context.WithCancel(context.Background())
+ defer cancel()
+
+ w.Start(ctx, "test")
+ done := make(chan bool)
+ go func() {
+ w.Done("test", true)
+ done <- true
+ }()
+
+ select {
+ case <-done:
+ case <-time.After(5 * time.Second):
+ t.Fatal("Deadlock detected: Done() did not complete within 5 seconds")
+ }
+}