Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streamed connection doesn't output anything #4

Closed
EwanValentine opened this issue Feb 16, 2015 · 5 comments
Closed

Streamed connection doesn't output anything #4

EwanValentine opened this issue Feb 16, 2015 · 5 comments

Comments

@EwanValentine
Copy link

Going by your example, I tried doing

process.stdin
            .pipe(exec('echo try typing something; cat -', hostInstance))
            .pipe(process.stdout);

It connects, but when I run a command, nothing happens?

Cheers in advance!

@mafintosh
Copy link
Owner

It should just echo what you type (thats what cat - does). Does this not work?

@EwanValentine
Copy link
Author

Ahh yes, that works. I was trying to implement this in order to start a terminal session as though you'd just ssh'd into a server in the traditional way. However, I don't get the host name or etc? If I run

process.stdin.pipe(exec('sh', hostInstance)).pipe(process.stdout);

I get a shell session, but there's no host name or anything, it's just blank?

Sorry if this doesn't make any sense, having trouble explaining this one!

@mafintosh
Copy link
Owner

Ah. What you wanna do is

var exec = require('ssh-exec')

process.stdin
  .pipe(exec('/bin/bash --rcfile .bashrc -i', 'user@remote.com'))
  .pipe(process.stdout)

@EwanValentine
Copy link
Author

Ahaaaa! Fantastic. Thanks for that :) Great library by the way.

@mafintosh
Copy link
Owner

👍 You probably want to set process.stdin.setRawMode(true) as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants