From d58e5585b62bd284a7e27045e748c2cf1d31a649 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Thu, 28 Sep 2023 23:50:05 +0100 Subject: scripts: Raise exception when file does not return supported object. * scripts/ccwl (main): Raise exception when file returns neither workflow nor command. --- scripts/ccwl | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/ccwl b/scripts/ccwl index fe8d114..b3762c5 100755 --- a/scripts/ccwl +++ b/scripts/ccwl @@ -26,7 +26,8 @@ exec guile --no-auto-compile -e main -s "$0" "$@" ;;; Code: -(use-modules (rnrs exceptions) +(use-modules (rnrs conditions) + (rnrs exceptions) (srfi srfi-28) (srfi srfi-37) (ice-9 match) @@ -119,8 +120,14 @@ Compile SOURCE-FILE. ((ccwl-violation? exception) (report-ccwl-violation exception) (exit #f))) - (load (canonicalize-path (assq-ref args 'source-file)) - read-syntax)) + (let ((result (load (canonicalize-path (assq-ref args 'source-file)) + read-syntax))) + (if (or (command? result) + (workflow? result)) + result + (raise-exception + (condition (formatted-message "Last expression in file ~a returns neither workflow nor command" + (assq-ref args 'source-file))))))) (current-output-port))))) ((program args ...) (let ((args (args-fold args -- cgit v1.2.3