diff --git a/cmd/meroxa/turbine_cli/javascript/deploy.go b/cmd/meroxa/turbine_cli/javascript/deploy.go index fbca0608d..c715e2650 100644 --- a/cmd/meroxa/turbine_cli/javascript/deploy.go +++ b/cmd/meroxa/turbine_cli/javascript/deploy.go @@ -5,6 +5,7 @@ import ( "fmt" "os" "os/exec" + "regexp" "strconv" "strings" @@ -13,15 +14,25 @@ import ( "github.com/meroxa/cli/log" ) +func processError(err error, path string, output []byte) (bool, error) { + fmterr := fmt.Errorf( + "unable to determine if the Meroxa Application at %s has a Process; %s", + path, + string(output)) + return false, fmterr +} + func NeedsToBuild(path string) (bool, error) { cmd := exec.Command("npx", "turbine", "hasfunctions", path) output, err := cmd.CombinedOutput() if err != nil { - err := fmt.Errorf( - "unable to determine if the Meroxa Application at %s has a Process; %s", - path, - string(output)) - return false, err + return processError(err, path, output) + } + + r, _ := regexp.Compile("\nturbine-response: (true|false)\n") + match := r.FindString(string(output)) + if match == "" { + return processError(err, path, output) } return strconv.ParseBool(strings.TrimSpace(string(output))) }