I'm creating a Process using Process.start and am a bit stuck with the stdin getter. Ideally, I've got a StreamController set up elsewhere, whose stream of Strings I'd like to pass into stdin. But there aren't too many sophisticated examples for interacting with Process.stdin, so I'm not sure how to do anything more than a writeln to stdin.
So I've got something like this, that I can add String messages to:
StreamController<String> processInput = new StreamController<String>.broadcast();
And I want to do something like this:
Process.start(executable, args, workingDirectory: dir.path, runInShell: true).then((Process process) {
process.stdout
.transform(UTF8.decoder)
.listen((data) {
s.add('[[CONSOLE_OUTPUT]]' + data);
});
process.stdin.addStream(input.stream);
});
I realize that addStream()
wants Stream<List<int>>
, though I'm not sure why that's the case.