External process output missing

Discussion in 'Java' started by Guifre, May 24, 2005.

  1. Guifre

    Guifre Guest

    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
     
    Guifre, May 24, 2005
    #1
    1. Advertising

  2. Guifre wrote:
    > 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

    --
    The comp.lang.java.gui FAQ:
    ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
     
    Thomas Weidenfeller, May 24, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. rtm
    Replies:
    0
    Views:
    801
  2. Scott Allen
    Replies:
    8
    Views:
    10,944
    Scott Allen
    May 2, 2004
  3. Brian Elmegaard
    Replies:
    2
    Views:
    993
    Robert Amesz
    Sep 10, 2003
  4. =?ISO-8859-1?Q?Reidar_=D8ksnevad?=

    Input / output to an external process

    =?ISO-8859-1?Q?Reidar_=D8ksnevad?=, Jul 28, 2006, in forum: Java
    Replies:
    0
    Views:
    437
    =?ISO-8859-1?Q?Reidar_=D8ksnevad?=
    Jul 28, 2006
  5. reid
    Replies:
    4
    Views:
    679
Loading...

Share This Page