@@ -24,7 +24,8 @@ import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider
24
24
25
25
class ScalaSshShell (port : Int , name :
26
26
String , user : String , passwd : String ,
27
- keysResourcePath : Option [String ]) {
27
+ keysResourcePath : Option [String ],
28
+ bindings : Seq [(String , String , Any )]) {
28
29
val sshd = org.apache.sshd.SshServer .setUpDefaultServer()
29
30
sshd.setPort(port)
30
31
sshd.setReuseAddress(true )
@@ -144,6 +145,8 @@ class ScalaSshShell(port: Int, name:
144
145
il.intp.initialize()
145
146
il.intp.beQuietDuring {
146
147
il.intp.bind(" stdout" , pw)
148
+ for ((bname, btype, bval) <- bindings)
149
+ il.bind(bname, btype, bval)
147
150
}
148
151
il.intp.quietRun(
149
152
""" def println(a: Any) = {
@@ -178,7 +181,11 @@ object ScalaSshShell {
178
181
def main (args : Array [String ]) {
179
182
val sshd = new ScalaSshShell (port= 4444 , name= " test" , user= " user" ,
180
183
passwd= " fluke" ,
181
- keysResourcePath= Some (" /test.ssh.keys" ))
184
+ keysResourcePath= Some (" /test.ssh.keys" ),
185
+ IndexedSeq (
186
+ (" pi" , " Double" , 3.1415926 ),
187
+ (" nums" , " IndexedSeq[Int]" ,
188
+ Vector (1 ,2 ,3 ,4 ,5 ))))
182
189
}
183
190
184
191
def generateKeys (path : String ) {
0 commit comments