Skip to content

Commit

Permalink
[workspacekit] Fix empty JSON deserialization error
Browse files Browse the repository at this point in the history
  • Loading branch information
aledbf authored and roboquat committed Sep 21, 2022
1 parent 6fd06ff commit 6bf56dc
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions components/workspacekit/cmd/rings.go
Original file line number Diff line number Diff line change
Expand Up @@ -834,11 +834,14 @@ var ring2Cmd = &cobra.Command{
Max uint64 `json:"hardLimit"`
}

rLimitValue := os.Getenv("GITPOD_RLIMIT_CORE")
var rLimitCore fakeRlimit
err = json.Unmarshal([]byte(rLimitValue), &rLimitCore)
if err != nil {
log.WithError(err).WithField("data", rLimitValue).Error("cannot deserialize GITPOD_RLIMIT_CORE")

rLimitValue := os.Getenv("GITPOD_RLIMIT_CORE")
if len(rLimitValue) != 0 {
err = json.Unmarshal([]byte(rLimitValue), &rLimitCore)
if err != nil {
log.WithError(err).WithField("data", rLimitValue).Error("cannot deserialize GITPOD_RLIMIT_CORE")
}
}

// we either set a limit or explicitly disable core dumps by setting 0 as values
Expand Down

0 comments on commit 6bf56dc

Please sign in to comment.