@@ -2,7 +2,6 @@ package tools
@@ -60,24 +59,6 @@ func TestBackgroundShell_Kill(t *testing.T) {
60 require.True(t, bgShell.IsDone())
59 require.True(t, bgShell.IsDone())
63−func TestBackgroundShell_GetOutput_NoHang(t *testing.T) {
66− workingDir := t.TempDir()
67− ctx := context.Background()
69− // Start a long-running background shell
70− bgManager := shell.GetBackgroundShellManager()
71− bgShell, err := bgManager.Start(ctx, workingDir, nil, "while true; do echo \"Hello from background job - $(date +%T)\"; sleep 1; done", "")
72− require.NoError(t, err)
73− defer bgManager.Kill(bgShell.ID)
74− // wait for 2 seconds
75− time.Sleep(2 * time.Second)
76− stdout, _, _, err := bgShell.GetOutput()
77− require.NoError(t, err)
78− require.Len(t, strings.Split(stdout, "\n"), 3)
81func TestBackgroundShell_MultipleOutputCalls(t *testing.T) {
62func TestBackgroundShell_MultipleOutputCalls(t *testing.T) {
82 t.Parallel()
63 t.Parallel()
@@ -345,27 +326,4 @@ func TestBackgroundShell_AutoBackground(t *testing.T) {
345 require.True(t, ok, "Should be able to retrieve background shell")
326 require.True(t, ok, "Should be able to retrieve background shell")
346 require.Equal(t, bgShell.ID, retrieved.ID)
327 require.Equal(t, bgShell.ID, retrieved.ID)
349− // Test that we can check output of long-running command later
350− t.Run("can check output after completion", func(t *testing.T) {
352− bgManager := shell.GetBackgroundShellManager()
353− bgShell, err := bgManager.Start(ctx, workingDir, nil, "sleep 3 && echo 'completed'", "")
354− require.NoError(t, err)
355− defer bgManager.Kill(bgShell.ID)
357− // Initially should be running
358− _, _, done, _ := bgShell.GetOutput()
359− require.False(t, done, "Should be running initially")
361− // Wait for completion
362− time.Sleep(4 * time.Second)
364− // Now should be done
365− stdout, stderr, done, err := bgShell.GetOutput()
366− require.NoError(t, err)
367− require.True(t, done, "Should be done after waiting")
368− require.Contains(t, stdout, "completed")
369− require.Empty(t, stderr)