Skip to content

Commit 074acd4

Browse files
jordanrh1bradfitz
authored andcommitted
windows/svc: use wevtutil.exe instead of powershell for windows/arm
Use wevtutil.exe to query event log instead of powershell's Get-EventLog command, which is not available on Windows IoT Core. Updates golang/go#26148 Change-Id: Idc16d0b18d2826730d2b4062388b2a764c4886c6 Reviewed-on: https://go-review.googlesource.com/c/154817 Run-TryBot: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent dcdaa63 commit 074acd4

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

windows/svc/svc_test.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,9 @@ func TestExample(t *testing.T) {
121121
t.Fatalf("Delete failed: %s", err)
122122
}
123123

124-
cmd := `Get-Eventlog -LogName Application -Newest 100` +
125-
` | Where Source -eq "myservice"` +
126-
` | Select -first 10` +
127-
` | Format-table -HideTableHeaders -property ReplacementStrings`
128-
out, err := exec.Command("powershell", "-Command", cmd).CombinedOutput()
124+
out, err := exec.Command("wevtutil.exe", "qe", "Application", "/q:*[System[Provider[@Name='myservice']]]", "/rd:true", "/c:10").CombinedOutput()
129125
if err != nil {
130-
t.Fatalf("powershell failed: %v\n%v", err, string(out))
126+
t.Fatalf("wevtutil failed: %v\n%v", err, string(out))
131127
}
132128
if want := strings.Join(append([]string{name}, args...), "-"); !strings.Contains(string(out), want) {
133129
t.Errorf("%q string does not contain %q", string(out), want)

0 commit comments

Comments
 (0)