Skip to content

Commit

Permalink
it's both stdout and stderr
Browse files Browse the repository at this point in the history
  • Loading branch information
janelletavares committed Apr 5, 2022
1 parent d9d96d1 commit 442d8d4
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cmd/meroxa/turbine_cli/golang/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ func RunDeployApp(ctx context.Context, l log.Logger, appPath, appName, imageName
cmd.Env = os.Environ()
cmd.Env = append(cmd.Env, fmt.Sprintf("ACCESS_TOKEN=%s", accessToken), fmt.Sprintf("REFRESH_TOKEN=%s", refreshToken))

stdout, err := cmd.CombinedOutput()
output, err := cmd.CombinedOutput()
if err != nil {
l.Errorf(ctx, "%s", string(stdout))
l.Errorf(ctx, "%s", string(output))
return "", fmt.Errorf("deploy failed")
}
l.Infof(ctx, "%s\ndeploy complete!", string(stdout))
return string(stdout), nil
l.Infof(ctx, "%s\ndeploy complete!", string(output))
return string(output), nil
}

// NeedsToBuild reads from the Turbine application to determine whether it needs to be built or not
Expand All @@ -58,14 +58,14 @@ func NeedsToBuild(appPath, appName string) (bool, error) {

// TODO: Implement in Turbine something that returns a boolean rather than having to regex its output
re := regexp.MustCompile(`\[(.+?)]`)
stdout, err := cmd.CombinedOutput()
output, err := cmd.CombinedOutput()
if err != nil {
fmt.Println(string(stdout))
fmt.Println(string(output))
return false, fmt.Errorf("build failed")
}

// stdout is expected as `"2022/03/14 17:33:06 available functions: []` where within [], there will be each function.
hasFunctions := len(re.FindAllString(string(stdout), -1)) > 0
hasFunctions := len(re.FindAllString(string(output), -1)) > 0

return hasFunctions, nil
}

0 comments on commit 442d8d4

Please sign in to comment.