summaryrefslogtreecommitdiff
path: root/internal/ui/shell.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/ui/shell.go')
-rw-r--r--internal/ui/shell.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/internal/ui/shell.go b/internal/ui/shell.go
index f497517..b3b6285 100644
--- a/internal/ui/shell.go
+++ b/internal/ui/shell.go
@@ -16,9 +16,9 @@ import (
const shellCommandTimeout = 2 * time.Minute
-func shellRunCmd(line string, selectedID int) tea.Cmd {
+func shellRunCmd(parent context.Context, line string, selectedID int) tea.Cmd {
return func() tea.Msg {
- ctx, cancel := context.WithTimeout(context.Background(), shellCommandTimeout)
+ ctx, cancel := context.WithTimeout(parent, shellCommandTimeout)
defer cancel()
result, err := task.RunShellLine(ctx, line)
@@ -26,6 +26,11 @@ func shellRunCmd(line string, selectedID int) tea.Cmd {
}
}
+func (m *Model) shellCommandContext() context.Context {
+ m.initTaskContext()
+ return m.taskContext
+}
+
func (m *Model) handleShellPrompt() (tea.Model, tea.Cmd) {
return m.openShellPrompt("")
}
@@ -65,7 +70,7 @@ func (m *Model) handleShellMode(msg tea.KeyPressMsg) (tea.Model, tea.Cmd) {
m.shellActive = false
m.shellInput.Blur()
m.updateTableHeight()
- return m, shellRunCmd(line, selectedID)
+ return m, shellRunCmd(m.shellCommandContext(), line, selectedID)
case "esc":
m.shellActive = false
m.shellInput.Blur()