diff --git a/libguile/posix-w32.c b/libguile/posix-w32.c index 1f00ec168..6a483c47e 100644 --- a/libguile/posix-w32.c +++ b/libguile/posix-w32.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2006, 2008, 2016 Free Software Foundation, Inc. +/* Copyright (C) 2001, 2006, 2008, 2016, 2018 Free Software Foundation, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -740,8 +740,11 @@ start_child (const char *exec_file, char **argv, CloseHandle (herr); CloseHandle (pi.hThread); - /* Posix requires to call the shell if execvp fails to invoke EXEC_FILE. */ - if (errno_save == ENOEXEC || errno_save == ENOENT) + /* Posix requires to call the shell if execvp fails to invoke EXEC_FILE. + * But if there are no arguments, this would just open an interactive + * cmd.exe shell, so return in that case. */ + if ((errno_save == ENOEXEC || errno_save == ENOENT) + && (argv[0] != NULL && argv[1] != NULL) { const char *shell = getenv ("ComSpec"); diff --git a/test-suite/tests/posix.test b/test-suite/tests/posix.test index fe130e2cd..d8975f02a 100644 --- a/test-suite/tests/posix.test +++ b/test-suite/tests/posix.test @@ -235,8 +235,9 @@ ;; With Guile up to 2.0.7 included, the child process launched by ;; `system*' would remain alive after an `execvp' failure. (let ((me (getpid))) - (and (not (zero? (system* "something-that-does-not-exist"))) - (= me (getpid)))))) + (and + (not (equal? 0 (false-if-exception (system* "something-that-does-not-exist")))) + (= me (getpid)))))) ;; ;; crypt @@ -245,12 +246,16 @@ (with-test-prefix "crypt" (pass-if "basic usage" - (string? (crypt "pass" "abcdefg"))) + (if (not (defined? 'crypt)) + (throw 'unsupported) + (string? (crypt "pass" "abcdefg")))) (pass-if-exception "glibc EINVAL" exception:system-error ;; This used to deadlock while trying to throw to 'system-error'. ;; This test uses the special interpretation of the salt that glibc ;; does; specifically, we pass a syntactically invalid salt here. - (if (string-contains %host-type "-gnu") - (crypt "pass" "$X$abc") ;EINVAL - (throw 'unresolved)))) + (if (not (defined? 'crypt)) + (throw 'unsupported) + (if (string-contains %host-type "-gnu") + (crypt "pass" "$X$abc") ;EINVAL + (throw 'unresolved)))))