This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Redirect stdout from SSH


On Fri, 6 Aug 2004, David E. Meier wrote:

> > At 01:03 PM 8/3/2004, you wrote:
> >>Hello list,
> >>
> >>I am writing a program in C# that calls some cygwin programs and redirects
> >>the standard output and error to a textbox. This works excellent with
> >>calls like "ls -al" or rsync.
> >>
> >>However, I cannot read the output generated by SSH. When I issue a command
> >>like "ssh user@host ls -al" I can observe some network action but the
> >>application stalls, uses 100% CPU and never spits out something. The same
> >>command in the cygwin shell executes with the result expected. Since I use
> >>public key authentication SSH is not waiting for any login information.
> >>
> >>Is this a configuration issue of SSH? Thanks for any help. Dave.
> >
> > Not AFAICS.  A small C program that invokes Cygwin's 'ssh' via 'system()'
> > with 'ls -al' works fine for me.  Does that work for you?
>
> I got it working when standard input is also set to be redirected. Does
> anyone have an explanation of this?
>
> Dave

By default, ssh is an interactive program, even if the program it invokes
isn't.  Therefore, ssh contains some code that sets up standard input and
its properties.  This code may cause some problems when invoked from a
non-pty-aware application (such as a C# program).  You can redirect
standard input, as you've already discovered, or simply use the '-n'
option to ssh.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Happiness lies in being privileged to work hard for long hours in doing
whatever you think is worth doing."  -- Dr. Jubal Harshaw

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]