@@ -117,7 +117,7 @@ func Prepare(ctx context.Context, inst *store.Instance) (*Prepared, error) {
117
117
118
118
// Start starts the instance.
119
119
// Start calls Prepare by itself, so you do not need to call Prepare manually before calling Start.
120
- func Start (ctx context.Context , inst * store.Instance , launchHostAgentForeground bool ) error {
120
+ func Start (ctx context.Context , inst * store.Instance , limactl string , launchHostAgentForeground bool ) error {
121
121
haPIDPath := filepath .Join (inst .Dir , filenames .HostAgentPID )
122
122
if _ , err := os .Stat (haPIDPath ); ! errors .Is (err , os .ErrNotExist ) {
123
123
return fmt .Errorf ("instance %q seems running (hint: remove %q if the instance is not actually running)" , inst .Name , haPIDPath )
@@ -150,9 +150,11 @@ func Start(ctx context.Context, inst *store.Instance, launchHostAgentForeground
150
150
return err
151
151
}
152
152
153
- self , err := os .Executable ()
154
- if err != nil {
155
- return err
153
+ if limactl == "" {
154
+ limactl , err = os .Executable ()
155
+ if err != nil {
156
+ return err
157
+ }
156
158
}
157
159
haStdoutPath := filepath .Join (inst .Dir , filenames .HostAgentStdoutLog )
158
160
haStderrPath := filepath .Join (inst .Dir , filenames .HostAgentStderrLog )
@@ -188,7 +190,7 @@ func Start(ctx context.Context, inst *store.Instance, launchHostAgentForeground
188
190
args = append (args , "--nerdctl-archive" , prepared .NerdctlArchiveCache )
189
191
}
190
192
args = append (args , inst .Name )
191
- haCmd := exec .CommandContext (ctx , self , args ... )
193
+ haCmd := exec .CommandContext (ctx , limactl , args ... )
192
194
193
195
if launchHostAgentForeground {
194
196
haCmd .SysProcAttr = executil .ForegroundSysProcAttr
@@ -220,7 +222,7 @@ func Start(ctx context.Context, inst *store.Instance, launchHostAgentForeground
220
222
return err
221
223
}
222
224
}
223
- if err := syscall .Exec (self , haCmd .Args , haCmd .Environ ()); err != nil {
225
+ if err := syscall .Exec (limactl , haCmd .Args , haCmd .Environ ()); err != nil {
224
226
return err
225
227
}
226
228
} else if err := haCmd .Start (); err != nil {
0 commit comments