38 lines
1.4 KiB
Scheme
38 lines
1.4 KiB
Scheme
#|
|
|
This file is part of Ordo.
|
|
|
|
Copyright (C) 2025 Ray Miller
|
|
|
|
This program is free software: you can redistribute it and/or modify it under
|
|
the terms of the GNU General Public License as published by the Free Software
|
|
Foundation, version 3.
|
|
|
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License along with
|
|
this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|#
|
|
|
|
(define-module (ordo connection local)
|
|
#:use-module (ice-9 popen)
|
|
#:use-module (oop goops)
|
|
#:use-module (ordo connection base)
|
|
#:use-module (ordo connection sudo)
|
|
#:use-module (ordo util read-lines)
|
|
#:export (<local-connection>))
|
|
|
|
(define-class <local-connection> (<sudo-connection>))
|
|
|
|
(define-method (remote-exec (c <local-connection>) (command <string>))
|
|
(let* ((port (open-input-pipe command))
|
|
(output (read-lines port))
|
|
(exit-status (status:exit-val (close-pipe port))))
|
|
(values output exit-status)))
|
|
|
|
(define-method (with-remote-input-file (c <local-connection>) (filename <string>) (proc <procedure>))
|
|
(call-with-input-file filename proc))
|
|
|
|
(define-method (with-remote-output-file (c <local-connection>) (filename <string>) (proc <procedure>))
|
|
(call-with-output-file filename proc))
|