mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-04 08:07:19 -04:00
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: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
dcdaa6325b
commit
074acd46bc
@@ -121,13 +121,9 @@ func TestExample(t *testing.T) {
|
|||||||
t.Fatalf("Delete failed: %s", err)
|
t.Fatalf("Delete failed: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := `Get-Eventlog -LogName Application -Newest 100` +
|
out, err := exec.Command("wevtutil.exe", "qe", "Application", "/q:*[System[Provider[@Name='myservice']]]", "/rd:true", "/c:10").CombinedOutput()
|
||||||
` | Where Source -eq "myservice"` +
|
|
||||||
` | Select -first 10` +
|
|
||||||
` | Format-table -HideTableHeaders -property ReplacementStrings`
|
|
||||||
out, err := exec.Command("powershell", "-Command", cmd).CombinedOutput()
|
|
||||||
if err != nil {
|
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) {
|
if want := strings.Join(append([]string{name}, args...), "-"); !strings.Contains(string(out), want) {
|
||||||
t.Errorf("%q string does not contain %q", string(out), want)
|
t.Errorf("%q string does not contain %q", string(out), want)
|
||||||
|
|||||||
Reference in New Issue
Block a user