add special case for conda activate/deactivate as well to rtnstate detection

This commit is contained in:
sawka 2023-12-18 15:07:13 -08:00
parent 8d71f5538c
commit f2eb383cc3
2 changed files with 11 additions and 0 deletions

View File

@ -241,6 +241,12 @@ func isRtnStateCmd(cmd syntax.Command) bool {
return true return true
} }
} }
if arg0 == "conda" {
arg1 := getCallExprLitArg(callExpr, 1)
if arg1 == "activate" || arg1 == "deactivate" {
return true
}
}
} else if _, ok := cmd.(*syntax.DeclClause); ok { } else if _, ok := cmd.(*syntax.DeclClause); ok {
return true return true
} }

View File

@ -60,4 +60,9 @@ func TestIsReturnStateCommand(t *testing.T) {
testRSC(t, ". ./test", true) testRSC(t, ". ./test", true)
testRSC(t, "{ FOO=6; }", true) testRSC(t, "{ FOO=6; }", true)
testRSC(t, "cd foo && ls -l", true) testRSC(t, "cd foo && ls -l", true)
testRSC(t, "ls -l && ./foo || git checkout main", true)
testRSC(t, "./foo || ./bar", false)
testRSC(t, ". foo.sh", true)
testRSC(t, "cd work; conda activate myenv", true)
testRSC(t, "asdf foo", true)
} }