Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home for dartlang.org
« Groups Home
Need Help: How do I send commands to a Process that takes commands from stdin?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
XulChris  
View profile  
 More options Aug 10 2012, 7:27 pm
From: XulChris <chris.st...@gmail.com>
Date: Fri, 10 Aug 2012 16:27:57 -0700 (PDT)
Local: Fri, Aug 10 2012 7:27 pm
Subject: Need Help: How do I send commands to a Process that takes commands from stdin?

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?

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kevin Kellogg  
View profile  
 More options Aug 10 2012, 11:17 pm
From: Kevin Kellogg <kello...@gmail.com>
Date: Fri, 10 Aug 2012 20:17:24 -0700 (PDT)
Local: Fri, Aug 10 2012 11:17 pm
Subject: Re: Need Help: How do I send commands to a Process that takes commands from stdin?

It looks like you're writing to p.stdin before it's ready. Try:

p.onStart = ()  {
 // p.stdin is ready now.

};

Kevin


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
XulChris  
View profile  
 More options Aug 11 2012, 7:58 pm
From: XulChris <chris.st...@gmail.com>
Date: Sat, 11 Aug 2012 16:58:16 -0700 (PDT)
Local: Sat, Aug 11 2012 7:58 pm
Subject: Re: Need Help: How do I send commands to a Process that takes commands from stdin?

Yep, that was it! Thanks. :)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »