From 2d46b8b43e396d3b48bfbe4df25cd517ca7aca38 Mon Sep 17 00:00:00 2001 From: Timothy Sample Date: Mon, 20 May 2019 00:27:07 -0400 Subject: [PATCH] Move 'setvbuf' shim to '(gash compat)'. * tests/unit/shell.scm: Mode 'setvbuf' shim... * gash/compat.scm: ...here. --- gash/compat.scm | 11 +++++++++++ tests/unit/shell.scm | 11 +---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/gash/compat.scm b/gash/compat.scm index fcd2a6b..60c3545 100644 --- a/gash/compat.scm +++ b/gash/compat.scm @@ -56,3 +56,14 @@ (define-public (exact-integer? x) (and (integer? x) (exact? x)))) #f) + +(cond-expand + ((and guile-2 (not guile-2.2)) + (define* (setvbuf port mode #:optional size) + (let ((mode (match mode + ('none _IONBF) + ('line _IOLBF) + ('block _IOFBF)))) + ((@ (guile) setvbuf) port mode size))) + (export! setvbuf)) + (else #f)) diff --git a/tests/unit/shell.scm b/tests/unit/shell.scm index c885a89..7dedfb4 100644 --- a/tests/unit/shell.scm +++ b/tests/unit/shell.scm @@ -17,6 +17,7 @@ ;;; along with Gash. If not, see . (define-module (test-shell) + #:use-module (gash compat) #:use-module (gash compat textual-ports) #:use-module (gash environment) #:use-module (gash shell) @@ -64,16 +65,6 @@ (delete-recursively directory) result)) -(cond-expand - ((and guile-2 (not guile-2.2)) - (define* (setvbuf port mode #:optional size) - (let ((mode (match mode - ('none _IONBF) - ('line _IOLBF) - ('block _IOFBF)))) - ((@ (guile) setvbuf) port mode size)))) - (else #f)) - (define (%make-script object . forms) (define (write-script port) (chmod port #o755)