(ctx context.Context, config common.Config, script string)
| 318 | } |
| 319 | |
| 320 | func createVm(ctx context.Context, config common.Config, script string) (*s.VM, error) { |
| 321 | scriptsPath, _ := config.GetDir(config.DrivesDir, false) |
| 322 | scriptBytes, e := os.ReadFile(filepath.Join(scriptsPath, script)) |
| 323 | if e != nil { |
| 324 | return nil, e |
| 325 | } |
| 326 | |
| 327 | vm := baseVM.Fork() |
| 328 | |
| 329 | _, e = vm.Run(ctx, scriptBytes) |
| 330 | return vm, e |
| 331 | } |
| 332 | |
| 333 | // wrapReader adapts an io.Reader into an io.ReadCloser. If reader already is a |
| 334 | // ReadCloser it is returned as-is, otherwise a no-op Close is added. |
no test coverage detected