Offline installers (roadmap M1.3): - internal/installer drives `reims-util --json offline-installer` and parses its JSON event stream (upstream reims-vgpu 3731afd, reims_util.rs:423-509) - downloads hold installers/.lock like reims-ctl, so the two never write the same file; checked against the real reims-ctl (TestLockExcludesReimsCtl) - pause = stop the process, rerun resumes; deletes go through `reims-ctl downloads delete`, which refuses files in use or downloading - CLI: reims-go installer list | download | cached | delete - Wails bindings: ListOfflineReleases, DownloadInstaller, ListInstallers, DeleteInstaller Task events (ui-redesign B1): - tasks.go tracks long-running work and emits "reims:task" (throttled to 200 ms per task); VM creation turns reims-ctl's progress lines into task progress and logs each step once - the status bar shows the current task with a progress bar, details in a tooltip and a pause button; the frontend regex merging is removed Win10 cold reboot workaround: - host probes whether WinHvPlatform.dll lacks WHvResetPartition (Win10 19045) - internal/qmp watches a dedicated QMP channel for guest resets; with -no-reboot the app restarts the VM in a fresh partition - architecture.md documents download routing and the workaround Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
47 lines
1.1 KiB
Go
47 lines
1.1 KiB
Go
//go:build windows
|
|
|
|
package installer
|
|
|
|
import (
|
|
"errors"
|
|
"os"
|
|
"os/exec"
|
|
"syscall"
|
|
|
|
"golang.org/x/sys/windows"
|
|
)
|
|
|
|
const createNoWindow = 0x08000000
|
|
|
|
func configureCmd(cmd *exec.Cmd) {
|
|
cmd.SysProcAttr = &syscall.SysProcAttr{
|
|
HideWindow: true,
|
|
CreationFlags: createNoWindow,
|
|
}
|
|
}
|
|
|
|
// tryLock takes an exclusive lock on the whole file without waiting. Rust's
|
|
// File::try_lock, which reims-ctl uses on the same file, is LockFileEx with
|
|
// LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY over (0, MAX), so the two
|
|
// exclude each other.
|
|
func tryLock(f *os.File) (bool, error) {
|
|
ol := new(windows.Overlapped)
|
|
err := windows.LockFileEx(
|
|
windows.Handle(f.Fd()),
|
|
windows.LOCKFILE_EXCLUSIVE_LOCK|windows.LOCKFILE_FAIL_IMMEDIATELY,
|
|
0, ^uint32(0), ^uint32(0), ol,
|
|
)
|
|
if err == nil {
|
|
return true, nil
|
|
}
|
|
if errors.Is(err, windows.ERROR_LOCK_VIOLATION) || errors.Is(err, windows.ERROR_IO_PENDING) {
|
|
return false, nil
|
|
}
|
|
return false, err
|
|
}
|
|
|
|
func unlock(f *os.File) {
|
|
ol := new(windows.Overlapped)
|
|
_ = windows.UnlockFileEx(windows.Handle(f.Fd()), 0, ^uint32(0), ^uint32(0), ol)
|
|
}
|