diff options
| author | Taras Madan <tarasmadan@google.com> | 2025-05-15 15:01:02 +0200 |
|---|---|---|
| committer | Taras Madan <tarasmadan@google.com> | 2025-05-19 09:39:47 +0000 |
| commit | 27f689959decd391b047c8034d481267d500549e (patch) | |
| tree | 79ce6364d592fd6841e25ec64ca645fc3c65cdcf /pkg/build/netbsd.go | |
| parent | 8f9cf946b3733d0b4ad3124bce155a4fc3849c3a (diff) | |
vm: func Run accepts context
It allows to use context as a single termination signal source.
Diffstat (limited to 'pkg/build/netbsd.go')
| -rw-r--r-- | pkg/build/netbsd.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg/build/netbsd.go b/pkg/build/netbsd.go index 31ae6de51..21564e1aa 100644 --- a/pkg/build/netbsd.go +++ b/pkg/build/netbsd.go @@ -4,6 +4,7 @@ package build import ( + "context" "encoding/json" "fmt" "os" @@ -155,7 +156,9 @@ func (ctx netbsd) copyKernelToDisk(targetArch, vmType, outputDir, kernel string) } commands = append(commands, "mknod /dev/vhci c 355 0") commands = append(commands, "sync") // Run sync so that the copied image is stored properly. - _, rep, err := inst.Run(time.Minute, reporter, strings.Join(commands, ";")) + ctxTimeout, cancel := context.WithTimeout(context.Background(), time.Minute) + defer cancel() + _, rep, err := inst.Run(ctxTimeout, reporter, strings.Join(commands, ";")) if err != nil { return fmt.Errorf("error syncing the instance %w", err) } |
