Skip to content

Commit 8e16122

Browse files
Icesourcetiny-x
authored andcommitted
fix: fix cpu exp destroy mode when suid is empty
Signed-off-by: Icesource <gonghuajian.ghj@alibaba-inc.com>
1 parent 039ce64 commit 8e16122

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

exec/exec.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ var cl = channel.NewLocalChannel()
3030
// stop hang process
3131
func Destroy(ctx context.Context, c spec.Channel, action string) *spec.Response {
3232
suid := ctx.Value(spec.Uid)
33-
/* If suid is specified, it will be deleted exactly
33+
/* If suid is specified, it will be deleted exactly
3434
* according to suid, otherwise it will be based on action. */
35-
if suid != nil && suid != spec.UnknownUid {
35+
if suid != nil && suid != spec.UnknownUid && suid != "" {
3636
ctx = context.WithValue(ctx, channel.ProcessKey, suid)
3737
} else {
3838
ctx = context.WithValue(ctx, channel.ProcessKey, action)

main.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,14 @@ func main() {
106106
}
107107

108108
uid := expModel.ActionFlags[model.UidFlag.Name]
109-
if uid == "" {
110-
uid, _ = util.GenerateUid()
111-
}
112109

113110
ctx = context.WithValue(ctx, spec.Uid, uid)
114111
if mode == spec.Destroy {
115112
ctx = spec.SetDestroyFlag(ctx, uid)
113+
} else {
114+
if uid == "" {
115+
uid, _ = util.GenerateUid()
116+
}
116117
}
117118

118119
if expModel.ActionFlags[model.DebugFlag.Name] == spec.True {

0 commit comments

Comments
 (0)