guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: repl: Look for script files in (getcwd).


From: guix-commits
Subject: branch master updated: repl: Look for script files in (getcwd).
Date: Wed, 16 Sep 2020 10:05:03 -0400

This is an automated email from the git hooks/post-receive script.

civodul pushed a commit to branch master
in repository guix.

The following commit(s) were added to refs/heads/master by this push:
     new d7f7ed3  repl: Look for script files in (getcwd).
d7f7ed3 is described below

commit d7f7ed39be3be926b3c46c0ea15d416c593ef61f
Author: Konrad Hinsen <konrad.hinsen@fastmail.net>
AuthorDate: Fri Sep 11 13:13:26 2020 +0200

    repl: Look for script files in (getcwd).
    
    Fixes <https://bugs.gnu.org/43331>.
    
    * guix/scripts/repl.scm (guix-repl): Replace "." by (getcwd)
    * tests/guix-repl.sh: Add test.
    
    Co-authored-by: Ludovic Courtès <ludo@gnu.org>
---
 guix/scripts/repl.scm | 5 ++++-
 tests/guix-repl.sh    | 4 ++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/guix/scripts/repl.scm b/guix/scripts/repl.scm
index 3c79e89..7d4e474 100644
--- a/guix/scripts/repl.scm
+++ b/guix/scripts/repl.scm
@@ -178,7 +178,10 @@ call THUNK."
        (lambda ()
          (set-program-arguments script)
          (set-user-module)
-         (load-in-vicinity "." (car script)))))
+
+         ;; When passed a relative file name, 'load-in-vicinity' searches the
+         ;; file in %LOAD-PATH.  Thus, pass (getcwd) instead of ".".
+         (load-in-vicinity (getcwd) (car script)))))
 
     (when (null? script)
       ;; Start REPL
diff --git a/tests/guix-repl.sh b/tests/guix-repl.sh
index e1c2b82..d4ebb5f 100644
--- a/tests/guix-repl.sh
+++ b/tests/guix-repl.sh
@@ -45,6 +45,10 @@ EOF
 
 test "`guix repl "$tmpfile"`" = "coreutils"
 
+# Make sure that the file can also be loaded when passed as a relative file
+# name.
+(cd "$(dirname "$tmpfile")"; test "$(guix repl "$(basename "$tmpfile")")" = 
"coreutils")
+
 
 cat > "$module_dir/foo.scm"<<EOF
 (define-module (foo)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]