aboutsummaryrefslogtreecommitdiffstats
path: root/vm/gce
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2024-07-08 12:45:31 +0200
committerAleksandr Nogikh <nogikh@google.com>2024-07-11 09:03:37 +0000
commitbdca406b2cf89f029207aa8213460ec7a3267ccc (patch)
tree077a43542b50ba8c6db9cc91567fb332032a3913 /vm/gce
parenta893841a9f868b1590b9dacfa772d634629ad88d (diff)
vm: make Instance implement io.Closer
It's better to follow standard interfaces.
Diffstat (limited to 'vm/gce')
-rw-r--r--vm/gce/gce.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/vm/gce/gce.go b/vm/gce/gce.go
index 12f49e3d7..8de0b56db 100644
--- a/vm/gce/gce.go
+++ b/vm/gce/gce.go
@@ -241,12 +241,16 @@ func (pool *Pool) Create(workdir string, index int) (vmimpl.Instance, error) {
return inst, nil
}
-func (inst *instance) Close() {
+func (inst *instance) Close() error {
close(inst.closed)
- inst.GCE.DeleteInstance(inst.name, false)
+ err := inst.GCE.DeleteInstance(inst.name, false)
if inst.consolew != nil {
- inst.consolew.Close()
+ err2 := inst.consolew.Close()
+ if err == nil {
+ err = err2
+ }
}
+ return err
}
func (inst *instance) Forward(port int) (string, error) {