Compare commits

...

2 Commits

Author SHA1 Message Date
a9e626393c Ignore exe files 2026-02-13 20:36:40 +01:00
1979fbf9f1 fix windows install script 2026-02-13 20:36:06 +01:00
2 changed files with 25 additions and 8 deletions

1
.gitignore vendored
View File

@@ -1 +1,2 @@
dist/
*.exe

View File

@@ -107,9 +107,9 @@ func registerWindowsScheduledTask(exePath, listen string, allow []string) error
ps := `
param(
[string]$ExePath,
[string]$Listen,
[string]$AllowJson
[string]$ExePath,
[string]$Listen,
[string]$AllowJson
)
$ErrorActionPreference = 'Stop'
$ServiceName = 'luxtools-client'
@@ -151,14 +151,30 @@ Register-ScheduledTask -TaskName $TaskName -InputObject $task -Force | Out-Null
try { Start-ScheduledTask -TaskName $TaskName | Out-Null } catch {}
`
psFile, err := os.CreateTemp("", "luxtools-client-install-*.ps1")
if err != nil {
return err
}
psPath := psFile.Name()
if _, err := psFile.WriteString(ps); err != nil {
_ = psFile.Close()
_ = os.Remove(psPath)
return err
}
if err := psFile.Close(); err != nil {
_ = os.Remove(psPath)
return err
}
defer os.Remove(psPath)
cmd := exec.Command("powershell.exe",
"-NoProfile",
"-NonInteractive",
"-ExecutionPolicy", "Bypass",
"-Command", ps,
exePath,
listen,
string(allowJSON),
"-File", psPath,
"-ExePath", exePath,
"-Listen", listen,
"-AllowJson", string(allowJSON),
)
out, err := cmd.CombinedOutput()
if err != nil {