This will only return the first error.
(handles ...windows.Handle)
| 221 | |
| 222 | // This will only return the first error. |
| 223 | func closeHandles(handles ...windows.Handle) error { |
| 224 | var err error |
| 225 | for _, h := range handles { |
| 226 | if h != windows.InvalidHandle { |
| 227 | if err == nil { |
| 228 | err = windows.CloseHandle(h) |
| 229 | } else { |
| 230 | windows.CloseHandle(h) |
| 231 | } |
| 232 | } |
| 233 | } |
| 234 | return err |
| 235 | } |
| 236 | |
| 237 | // Close all open handles and terminate the process. |
| 238 | func (cpty *ConPty) Close() error { |