incubate: process package 70 pass 1 fail

This commit is contained in:
Patrick Stewart 2024-12-30 21:12:12 -07:00
parent fc028630b9
commit 331443c512
2 changed files with 7 additions and 2 deletions

View file

@ -67,6 +67,11 @@ class InvokedProcess {
}
}
/// Close the process stdin.
Future<void> closeStdin() async {
await _process.stdin.close();
}
/// Signal the process.
bool kill([ProcessSignal signal = ProcessSignal.sigterm]) {
_killed = true;

View file

@ -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)));