Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: How to execute Net::OpenSSH remote command requiring input

by salva (Abbot)
on Oct 26, 2009 at 15:13 UTC ( #803295=note: print w/replies, xml ) Need Help??


in reply to How to execute Net::OpenSSH remote command requiring input

You can feed data to the remote process using the stdin_data option as follows:
$ssh = Net::OpenSSH->new($hostname, user => $username, master_stderr_d +iscard => 1} $command = "cd /usr/local/bin; interactive_program.pl"; @out = $ssh->capture({stdin_data => "input1\ninput2\ninput3\n"}, $comm +and);
Though, I don't think that will solve your problem... the Expect approach seems more promising!

Replies are listed 'Best First'.
Re^2: How to execute Net::OpenSSH remote command requiring input
by avonnieda (Novice) on Oct 26, 2009 at 15:55 UTC

    Ahh, I see, didn't know about that option either. Thanks very much for the reply salva! The expect method is working great, the sample was very helpful.

    Best regards,
    -Adam

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://803295]
help
Chatterbox?
[virtualsue]: Nor am I :-)
[talexb]: virtualsue Heh .. long time no see! :)
[virtualsue]: I have a quiet Perl themed slack workspace
[virtualsue]: The person who talks to me on it the most *hates* Perl but she hates everything
[virtualsue]: If anyone is interested, ping me an email address for an invitation.
[virtualsue]: I welcome any talktaive people who do not mind using a propietary walled-garden service for free
[virtualsue]: or even proprietary
[virtualsue]: we talk about programming and music and stuff

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (12)
As of 2017-09-26 13:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (295 votes). Check out past polls.

    Notices?