External process output missing

G

Guifre

Hello,

I'm using Runtime.getRuntime().exec(procedureFile) to run external
system commands stored in procedure files, and I get their output from
process.getInputStream().

This works OK in Windows, but when I try it in a Unix system I get the
direct output (i.e. procedure echos) but not the output from the
programs run by the procedure. For example:

#!/bin/sh
PATH=/bin:/usr/bin:/usr/local/bin:/usr/local/sysadm/bin:
export PATH
echo "Starting remote copy for $1"
scp -r $1 map@remotehost:/apps/myapp
echo "End of remote copy for $1"

would return the two echo messages, but not the output from scp.

Is there something that must be done or declared to get all the output
in Unix?

Thanks for any hint,

Guifre
 
T

Thomas Weidenfeller

Guifre said:
This works OK in Windows, but when I try it in a Unix system I get the
direct output (i.e. procedure echos) but not the output from the
programs run by the procedure. For example:

#!/bin/sh
PATH=/bin:/usr/bin:/usr/local/bin:/usr/local/sysadm/bin:
export PATH
echo "Starting remote copy for $1"
scp -r $1 map@remotehost:/apps/myapp
echo "End of remote copy for $1"

This has nothing to do with Java. This is scp's normal behavior. If scp
detects that stdout is not a tty, it doesn't write to stdout.

You can for example:

- try to get a hacked version of scp which doesn't do it
(not a great idea)

- use expect

- use Stevens' pty program

- use pty4 from comp.sources.unix Volume 25, issue 127 ... 136

/Thomas
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top