incubate: process package 70 pass 1 fail
This commit is contained in:
parent
fc028630b9
commit
331443c512
2 changed files with 7 additions and 2 deletions
|
@ -67,6 +67,11 @@ class InvokedProcess {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Close the process stdin.
|
||||||
|
Future<void> closeStdin() async {
|
||||||
|
await _process.stdin.close();
|
||||||
|
}
|
||||||
|
|
||||||
/// Signal the process.
|
/// Signal the process.
|
||||||
bool kill([ProcessSignal signal = ProcessSignal.sigterm]) {
|
bool kill([ProcessSignal signal = ProcessSignal.sigterm]) {
|
||||||
_killed = true;
|
_killed = true;
|
||||||
|
|
|
@ -50,7 +50,7 @@ void main() {
|
||||||
|
|
||||||
process.write('Hello');
|
process.write('Hello');
|
||||||
process.write(' World');
|
process.write(' World');
|
||||||
await process.kill(); // Force process to complete
|
await process.closeStdin();
|
||||||
final result = await process.wait();
|
final result = await process.wait();
|
||||||
expect(result.output().trim(), equals('Hello World'));
|
expect(result.output().trim(), equals('Hello World'));
|
||||||
}, timeout: Timeout(Duration(seconds: 5)));
|
}, timeout: Timeout(Duration(seconds: 5)));
|
||||||
|
@ -60,7 +60,7 @@ void main() {
|
||||||
final process = await factory.command(['cat']).start();
|
final process = await factory.command(['cat']).start();
|
||||||
|
|
||||||
process.write([72, 101, 108, 108, 111]); // "Hello" in bytes
|
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();
|
final result = await process.wait();
|
||||||
expect(result.output().trim(), equals('Hello'));
|
expect(result.output().trim(), equals('Hello'));
|
||||||
}, timeout: Timeout(Duration(seconds: 5)));
|
}, timeout: Timeout(Duration(seconds: 5)));
|
||||||
|
|
Loading…
Reference in a new issue