(timeout time.Duration)
| 237 | } |
| 238 | |
| 239 | func (wcw WslCmdWrap) KillGraceful(timeout time.Duration) { |
| 240 | process := wcw.WslCmd.GetProcess() |
| 241 | if process == nil { |
| 242 | return |
| 243 | } |
| 244 | processState := wcw.WslCmd.GetProcessState() |
| 245 | if processState != nil && processState.Exited() { |
| 246 | return |
| 247 | } |
| 248 | process.Signal(os.Interrupt) |
| 249 | go func() { |
| 250 | defer func() { |
| 251 | panichandler.PanicHandler("KillGraceful-wsl:Kill", recover()) |
| 252 | }() |
| 253 | time.Sleep(timeout) |
| 254 | process := wcw.WslCmd.GetProcess() |
| 255 | processState := wcw.WslCmd.GetProcessState() |
| 256 | if processState == nil || !processState.Exited() { |
| 257 | process.Kill() // force kill if it is already not exited |
| 258 | } |
| 259 | }() |
| 260 | } |
| 261 | |
| 262 | /** |
| 263 | * SetSize does nothing for WslCmdWrap as there |
nothing calls this directly
no test coverage detected