Pre-Windows-VM hardening — the parts validatable on Linux, leaving the unrunnable FFI (Job Object, T-424) for the VM session: - Clamp PTY cols/rows to >= 2 in both backends' spawn + resize (new pty_size.dart). A 1-column ConPTY makes conhost spin emitting CRLF (microsoft/terminal#19922); 0 is invalid on both platforms. - ci/test.sh: --timeout 60s on the dart-test pty line (matches the flutter lines) so a wedged ConPTY reader fails fast instead of hanging the run. - Make windows_pty.dart's pure helpers public + testable off-Windows: quoteArg (MSVCRT quoting), composeEnvironmentBlock, and resolveExecutable (now takes an injectable existence probe). New windows_pty_args_test.dart + pty_size_test.dart give 15 cross-platform assertions over the trickiest Windows logic the on-Windows smoke suite can't reach off-platform. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
16 lines
736 B
Dart
16 lines
736 B
Dart
/// Minimum dimension handed to any PTY backend.
|
|
///
|
|
/// A 1-column ConPTY makes the Windows conhost spin emitting CRLF forever
|
|
/// (microsoft/terminal#19922), and a 0 in either axis is invalid on both
|
|
/// platforms. Every backend clamps its spawn + resize through this, so a
|
|
/// degenerate size from the UI — a pane measured at zero width during a
|
|
/// transient layout pass — can never wedge a child. The floor (2) is below
|
|
/// any real terminal, so the clamp is invisible in normal use.
|
|
library;
|
|
|
|
/// Smallest column/row count a PTY backend will accept.
|
|
const int minPtyDimension = 2;
|
|
|
|
/// Clamp a column or row count up to [minPtyDimension].
|
|
int clampPtyDimension(int value) => value < minPtyDimension ? minPtyDimension : value;
|