From f2eb383cc38ac5116dea396fd713bd45bff915f3 Mon Sep 17 00:00:00 2001 From: sawka Date: Mon, 18 Dec 2023 15:07:13 -0800 Subject: [PATCH] add special case for conda activate/deactivate as well to rtnstate detection --- wavesrv/pkg/cmdrunner/shparse.go | 6 ++++++ wavesrv/pkg/cmdrunner/shparse_test.go | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/wavesrv/pkg/cmdrunner/shparse.go b/wavesrv/pkg/cmdrunner/shparse.go index ac594068f..55cdfbaf0 100644 --- a/wavesrv/pkg/cmdrunner/shparse.go +++ b/wavesrv/pkg/cmdrunner/shparse.go @@ -241,6 +241,12 @@ func isRtnStateCmd(cmd syntax.Command) bool { return true } } + if arg0 == "conda" { + arg1 := getCallExprLitArg(callExpr, 1) + if arg1 == "activate" || arg1 == "deactivate" { + return true + } + } } else if _, ok := cmd.(*syntax.DeclClause); ok { return true } diff --git a/wavesrv/pkg/cmdrunner/shparse_test.go b/wavesrv/pkg/cmdrunner/shparse_test.go index a41670eab..ad9d9e167 100644 --- a/wavesrv/pkg/cmdrunner/shparse_test.go +++ b/wavesrv/pkg/cmdrunner/shparse_test.go @@ -60,4 +60,9 @@ func TestIsReturnStateCommand(t *testing.T) { testRSC(t, ". ./test", true) testRSC(t, "{ FOO=6; }", 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) }