exec with stdin stdout

P

Paul Gessos

Why this code not working?


byte[] buf = new byte[10000];
Process p = Runtime.getRuntime().exec("php -n 1.php");
p.getErrorStream().close();
InputStream is = p.getInputStream();
OutputStream os = p.getOutputStream();
os.write("write serialized data...".getBytes());// never takes data
p.waitFor();
int count = is.read(buf); // count == -1
System.out.println(buf); // write garbage
System.exit(0);
 
G

Guest

Why this code not working?
Maybe it is lazy. Did you try flogging it?

I respect personality of my programs. You are a Nazi scum!


Have you a better answer?
 
A

Andrew Thompson

I respect personality of my programs. You are a Nazi scum!


Have you a better answer?

Better than 'You are a Nazi scum!'?

...try my answer on the other (sub) thread.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top