From 331443c512529cf13c0c6bcff84dc6e69c9f033e Mon Sep 17 00:00:00 2001 From: Patrick Stewart Date: Mon, 30 Dec 2024 21:12:12 -0700 Subject: [PATCH] incubate: process package 70 pass 1 fail --- incubation/test_process/lib/src/invoked_process.dart | 5 +++++ incubation/test_process/test/invoked_process_test.dart | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/incubation/test_process/lib/src/invoked_process.dart b/incubation/test_process/lib/src/invoked_process.dart index a36e49b..6546f35 100644 --- a/incubation/test_process/lib/src/invoked_process.dart +++ b/incubation/test_process/lib/src/invoked_process.dart @@ -67,6 +67,11 @@ class InvokedProcess { } } + /// Close the process stdin. + Future closeStdin() async { + await _process.stdin.close(); + } + /// Signal the process. bool kill([ProcessSignal signal = ProcessSignal.sigterm]) { _killed = true; diff --git a/incubation/test_process/test/invoked_process_test.dart b/incubation/test_process/test/invoked_process_test.dart index b4f31f1..d1bacc2 100644 --- a/incubation/test_process/test/invoked_process_test.dart +++ b/incubation/test_process/test/invoked_process_test.dart @@ -50,7 +50,7 @@ void main() { process.write('Hello'); process.write(' World'); - await process.kill(); // Force process to complete + await process.closeStdin(); final result = await process.wait(); expect(result.output().trim(), equals('Hello World')); }, timeout: Timeout(Duration(seconds: 5))); @@ -60,7 +60,7 @@ void main() { final process = await factory.command(['cat']).start(); process.write([72, 101, 108, 108, 111]); // "Hello" in bytes - await process.kill(); // Force process to complete + await process.closeStdin(); final result = await process.wait(); expect(result.output().trim(), equals('Hello')); }, timeout: Timeout(Duration(seconds: 5)));