diff options
| author | Artyom V. Poptsov <poptsov.artyom@gmail.com> | 2015-12-04 21:37:42 +0300 |
|---|---|---|
| committer | Artyom V. Poptsov <poptsov.artyom@gmail.com> | 2015-12-04 21:37:42 +0300 |
| commit | 82b5396a1f1d45c7ea7eebd1544ba8099bcee9a4 (patch) | |
| tree | 1dc5e7e7904f74d2dc50d573bd1948ee5f3af61c /modules/ssh | |
| parent | session.scm: Implement SSH config parsing (diff) | |
| download | guile-ssh-82b5396a1f1d45c7ea7eebd1544ba8099bcee9a4.tar.gz | |
channel.scm: Add remote pipes
* modules/ssh/channel.scm (open-remote-pipe, open-remote-pipe*): New
procedures.
* doc/api-channels.texi: Add "Remote Pipes" section.
* NEWS: Update.
Diffstat (limited to 'modules/ssh')
| -rw-r--r-- | modules/ssh/channel.scm | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/modules/ssh/channel.scm b/modules/ssh/channel.scm index ce35bd3..e65d946 100644 --- a/modules/ssh/channel.scm +++ b/modules/ssh/channel.scm @@ -66,7 +66,11 @@ channel-get-session channel-get-exit-status channel-open? - channel-eof?)) + channel-eof? + + ;; High-level procedures. + open-remote-pipe + open-remote-pipe*)) (define* (channel-open-forward channel @@ -104,6 +108,26 @@ issued." (%channel-accept-forward session timeout)) +;;; High-level procedures. +;; TODO: Add error handling. + +(define (open-remote-pipe session command) + "Execute a COMMAND on the remote host using a SESSION with a pipe to it. +The pipe works in both directions. Returns newly created port (channel)." + (let ((channel (make-channel session))) + (channel-open-session channel) + (channel-request-pty channel) + (channel-request-exec channel command) + channel)) + +(define (open-remote-pipe* session prog . args) + "Execute COMMANDS on the remote host using a SESSION with a pipe to it. The +pipe works in both directions. Returns newly created port (channel)." + (open-remote-pipe session (string-join (cons prog args)))) + +;;; + + (load-extension "libguile-ssh" "init_channel") ;;; channel.scm ends here. |
