On Friday, August 10, 2012 8:17:24 PM UTC-7, Kevin Kellogg wrote:
> It looks like you're writing to p.stdin before it's ready. Try:
> p.onStart = () {
> // p.stdin is ready now.
> };
> Kevin
> On Friday, August 10, 2012 7:27:57 PM UTC-4, XulChris wrote:
>> Hi, I'm trying to write a dart application that can talk to a standalone
>> process on my server, I need to be able to both read and write to that
>> process.
>> The dartlang web site shows a nice example of how to get output from a
>> process here:
>> http://www.dartlang.org/articles/io/#processes
>> However, this example does not show how to write data to the process'
>> stdin.
>> Here is my broken, non-working code:
>> void main() {
>> var p = Process.start('/usr/local/bin/stockfish', []);
>> var stdoutStream = new StringInputStream(p.stdout);
>> stdoutStream.onLine = () => print(stdoutStream.readLine());
>> p.stdin.writeString("exit\n", Encoding.ASCII); // SocketIOException:
>> writeList failed - invalid socket handle
>> p.onExit = (exitCode) {
>> print('exit code: $exitCode');
>> p.close();
>> };
>> }
>> Please help. Am I doing this wrong? How do I send a command to a process
>> that takes commands from stdin?