@@ -155,25 +155,26 @@ var removePodCommand = &cli.Command{
155
155
156
156
funcs := []func () error {}
157
157
for _ , id := range ids {
158
+ podId := id
158
159
funcs = append (funcs , func () error {
159
160
resp , err := runtimeClient .PodSandboxStatus (context .Background (),
160
- & pb.PodSandboxStatusRequest {PodSandboxId : id })
161
+ & pb.PodSandboxStatusRequest {PodSandboxId : podId })
161
162
if err != nil {
162
- return errors .Wrapf (err , "getting sandbox status of pod %q" , id )
163
+ return errors .Wrapf (err , "getting sandbox status of pod %q" , podId )
163
164
}
164
165
if resp .Status .State == pb .PodSandboxState_SANDBOX_READY {
165
166
if ctx .Bool ("force" ) {
166
- if err := StopPodSandbox (runtimeClient , id ); err != nil {
167
- return errors .Wrapf (err , "stopping the pod sandbox %q failed" , id )
167
+ if err := StopPodSandbox (runtimeClient , podId ); err != nil {
168
+ return errors .Wrapf (err , "stopping the pod sandbox %q failed" , podId )
168
169
}
169
170
} else {
170
- return errors .Errorf ("pod sandbox %q is running, please stop it first" , id )
171
+ return errors .Errorf ("pod sandbox %q is running, please stop it first" , podId )
171
172
}
172
173
}
173
174
174
- err = RemovePodSandbox (runtimeClient , id )
175
+ err = RemovePodSandbox (runtimeClient , podId )
175
176
if err != nil {
176
- return errors .Wrapf (err , "removing the pod sandbox %q" , id )
177
+ return errors .Wrapf (err , "removing the pod sandbox %q" , podId )
177
178
}
178
179
179
180
return nil
0 commit comments