Count ~/ as dynamic for resolving source paths.
This commit is contained in:
parent
8f5f91f041
commit
630f20e888
|
@ -147,6 +147,9 @@ prop_canSourceBadSyntax =
|
||||||
prop_cantSourceDynamic =
|
prop_cantSourceDynamic =
|
||||||
[1090] == checkWithIncludes [("lib", "")] ". \"$1\""
|
[1090] == checkWithIncludes [("lib", "")] ". \"$1\""
|
||||||
|
|
||||||
|
prop_cantSourceDynamic2 =
|
||||||
|
[1090] == checkWithIncludes [("lib", "")] "source ~/foo"
|
||||||
|
|
||||||
prop_canSourceDynamicWhenRedirected =
|
prop_canSourceDynamicWhenRedirected =
|
||||||
null $ checkWithIncludes [("lib", "")] "#shellcheck source=lib\n. \"$1\""
|
null $ checkWithIncludes [("lib", "")] "#shellcheck source=lib\n. \"$1\""
|
||||||
|
|
||||||
|
|
|
@ -1536,7 +1536,11 @@ readSimpleCommand = called "simple command" $ do
|
||||||
readSource :: Monad m => SourcePos -> Token -> SCParser m Token
|
readSource :: Monad m => SourcePos -> Token -> SCParser m Token
|
||||||
readSource pos t@(T_Redirecting _ _ (T_SimpleCommand _ _ (cmd:file:_))) = do
|
readSource pos t@(T_Redirecting _ _ (T_SimpleCommand _ _ (cmd:file:_))) = do
|
||||||
override <- getSourceOverride
|
override <- getSourceOverride
|
||||||
let literalFile = override `mplus` getLiteralString file
|
let literalFile = do
|
||||||
|
name <- override `mplus` getLiteralString file
|
||||||
|
-- Hack to avoid 'source ~/foo' trying to read from literal tilde
|
||||||
|
guard . not $ "~/" `isPrefixOf` name
|
||||||
|
return name
|
||||||
case literalFile of
|
case literalFile of
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
parseNoteAt pos WarningC 1090
|
parseNoteAt pos WarningC 1090
|
||||||
|
|
Loading…
Reference in New Issue