Skip to content

Commit fc2fcf6

Browse files
committed
task: WithExit() doesn't have to overwrite existing options
Signed-off-by: Andrei Vagin <[email protected]>
1 parent 394784b commit fc2fcf6

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

cmd/ctr/commands/tasks/checkpoint.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,22 @@ func withExit(rt string) containerd.CheckpointTaskOpts {
7878
return func(r *containerd.CheckpointTaskInfo) error {
7979
switch rt {
8080
case "io.containerd.runc.v1":
81-
r.Options = &options.CheckpointOptions{
82-
Exit: true,
81+
if r.Options == nil {
82+
r.Options = &options.CheckpointOptions{
83+
Exit: true,
84+
}
85+
} else {
86+
opts, _ := r.Options.(*options.CheckpointOptions)
87+
opts.Exit = true
8388
}
8489
default:
85-
r.Options = &runctypes.CheckpointOptions{
86-
Exit: true,
90+
if r.Options == nil {
91+
r.Options = &runctypes.CheckpointOptions{
92+
Exit: true,
93+
}
94+
} else {
95+
opts, _ := r.Options.(*runctypes.CheckpointOptions)
96+
opts.Exit = true
8797
}
8898
}
8999
return nil

0 commit comments

Comments
 (0)