Commit 074acd46 authored by Jordan Rhee's avatar Jordan Rhee Committed by Brad Fitzpatrick

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 <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent dcdaa632
......@@ -121,13 +121,9 @@ func TestExample(t *testing.T) {
t.Fatalf("Delete failed: %s", err)
}
cmd := `Get-Eventlog -LogName Application -Newest 100` +
` | Where Source -eq "myservice"` +
` | Select -first 10` +
` | Format-table -HideTableHeaders -property ReplacementStrings`
out, err := exec.Command("powershell", "-Command", cmd).CombinedOutput()
out, err := exec.Command("wevtutil.exe", "qe", "Application", "/q:*[System[Provider[@Name='myservice']]]", "/rd:true", "/c:10").CombinedOutput()
if err != nil {
t.Fatalf("powershell failed: %v\n%v", err, string(out))
t.Fatalf("wevtutil failed: %v\n%v", err, string(out))
}
if want := strings.Join(append([]string{name}, args...), "-"); !strings.Contains(string(out), want) {
t.Errorf("%q string does not contain %q", string(out), want)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment