Skip to content

Commit 4d6101d

Browse files
committed
clarify comment even more
1 parent 520710f commit 4d6101d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/termexec/termexec.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,11 @@ func StartProcess(ctx context.Context, args StartProcessConfig) (*Process, error
5858
// 4. Without deadlines, ReadRune blocks until the process outputs data
5959
//
6060
// Why this matters:
61-
// If we wrapped ReadRune + lastScreenUpdate in a mutex, ReadScreen would
62-
// block waiting for new process output. This would make the terminal
63-
// appear frozen even when just reading the current state.
61+
// If we wrapped ReadRune + lastScreenUpdate in a mutex, this goroutine would
62+
// hold the lock while waiting for process output. Since ReadRune blocks indefinitely,
63+
// ReadScreen callers would be locked out until new output arrives. Even worse,
64+
// after output arrives, this goroutine could immediately reacquire the lock
65+
// for the next ReadRune call, potentially starving ReadScreen callers indefinitely.
6466
//
6567
// Solution:
6668
// Instead of using xp.ReadRune(), we directly use its internal components:

0 commit comments

Comments
 (0)