diff --git a/src/ShellCheck/Analytics.hs b/src/ShellCheck/Analytics.hs index f6208e72b..e9707cf88 100644 --- a/src/ShellCheck/Analytics.hs +++ b/src/ShellCheck/Analytics.hs @@ -5244,6 +5244,7 @@ checkExpansionWithRedirection params t = _ -> return () checkCmd captureId (T_Redirecting _ redirs _) = foldr (walk captureId) (return ()) redirs + checkCmd _ _ = return () walk captureId t acc = case t of diff --git a/src/ShellCheck/Checker.hs b/src/ShellCheck/Checker.hs index 8060d05ee..92b73c266 100644 --- a/src/ShellCheck/Checker.hs +++ b/src/ShellCheck/Checker.hs @@ -352,6 +352,14 @@ prop_sourcedFileUsesOriginalShellExtension = result == [2079] csCheckSourced = True } +prop_sourcedCommandInExpansionDoesntCrash = result == [2034] + where + result = checkWithSpec [("lib.sh", "echo hello")] emptyCheckSpec { + csFilename = "file.bash", + csScript = "x=$(source lib.sh)", + csCheckSourced = True + } + prop_canEnableOptionalsWithSpec = result == [2244] where result = checkWithSpec [] emptyCheckSpec {