Compare commits
2 Commits
c4e53c5799
...
a9e626393c
| Author | SHA1 | Date | |
|---|---|---|---|
| a9e626393c | |||
| 1979fbf9f1 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1 +1,2 @@
|
||||
dist/
|
||||
dist/
|
||||
*.exe
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user