[Gambas-user] PEEK and managing ssh

Admin admin at allunix.ru
Tue Feb 11 08:11:27 CET 2020


That is very good news!!! Thanks! Can't wait to try it, have a demand 
for it.

Dmitry.


11.02.2020 8:02, Benoît Minisini пишет:
> Hi,
>
> In the last commit, I have added two new features:
>
> 1) A PEEK command, that allows to peek some bytes from a stream 
> without removing them, so that they are available to the next READ 
> instruction.
>
> Note that if you issue another PEEK, without having called READ 
> before, then the bytes are lost. In other words, the second PEEK does 
> not read the same bytes again.
>
> 2) A new class named "Terminal". The name is not very good, it may 
> change if I find or if someone suggests something better.
>
> This class encapsulates a Process object, and provides an Expect() 
> method that allows to tell what to answer to the process when it 
> issues a specific prompt.
>
> This is useful for commands that work by asking passwords to the user 
> without being able to take it from its arguments.
>
> For example, if you want to run an "scp" command from Gambas, you will 
> do that:
>
>   hProcess = Exec ["scp", ... ] For Input Output As "Process"
>
>   hTerminal = New Terminal(hProcess) As "Terminal"
>
>   hTerminal.Expect("(yes/no*)?", "yes")
>   hTerminal.Expect(":", "the password for my ssh key")
>
>   hProcess.Wait
>
> Comments, suggestions and questions are welcome!
>
> Regards,
>



More information about the User mailing list