diff options
author | Alex Kost <alezost@gmail.com> | 2015-08-30 18:44:39 +0300 |
---|---|---|
committer | Alex Kost <alezost@gmail.com> | 2015-09-01 13:03:50 +0300 |
commit | 8b9ceb8d03ab7b67cab9ce96b66f197c331ccc04 (patch) | |
tree | 45eafc60c8a87bd9b9a0eef255898155d1a51284 | |
parent | cdd383e9f31a37046c388054e0ac7b59cad3dd6a (diff) | |
download | gnu-guix-8b9ceb8d03ab7b67cab9ce96b66f197c331ccc04.tar gnu-guix-8b9ceb8d03ab7b67cab9ce96b66f197c331ccc04.tar.gz |
emacs: Add code to pipe guix output to external program.
* emacs/guix-main.scm: Use (ice-9 popen) module.
(pipe-guix-output): New procedure.
-rw-r--r-- | emacs/guix-main.scm | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm index fe224fb582..8d3a88152d 100644 --- a/emacs/guix-main.scm +++ b/emacs/guix-main.scm @@ -45,6 +45,7 @@ (use-modules (ice-9 vlist) (ice-9 match) + (ice-9 popen) (srfi srfi-1) (srfi srfi-2) (srfi srfi-11) @@ -949,6 +950,15 @@ GENERATIONS is a list of generation numbers." "Return string with 'guix COMMANDS ... --help' output." (apply guix-command-output `(,@commands "--help"))) +(define (pipe-guix-output guix-args command-args) + "Run 'guix GUIX-ARGS ...' command and pipe its output to a shell command +defined by COMMAND-ARGS. +Return #t if the shell command was executed successfully." + (let ((pipe (apply open-pipe* OPEN_WRITE command-args))) + (with-output-to-port pipe + (lambda () (apply guix-command guix-args))) + (zero? (status:exit-val (close-pipe pipe))))) + ;;; Lists of packages, lint checkers, etc. |