Skip to content

Commit

Permalink
Merge pull request #16 from bugsnag/kattrali/windows-support
Browse files Browse the repository at this point in the history
  • Loading branch information
kattrali authored Jan 12, 2021
2 parents d4891a2 + a1a1ee2 commit dce6864
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 30 deletions.
21 changes: 8 additions & 13 deletions .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,25 @@ on: [ push, pull_request ]
jobs:
test:

runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}-latest
defaults:
run:
working-directory: 'go/src/github.com/bugsnag/panicwrap' # relative to $GITHUB_WORKSPACE
strategy:
fail-fast: false
matrix:
go-version: ['1.7', '1.8', '1.9', '1.10', '1.11', '1.12', '1.13', '1.14', '1.15']
os: [ubuntu, windows]
go-version: ['1.9', '1.10', '1.11', '1.12', '1.13', '1.14', '1.15']

steps:
- uses: actions/checkout@v2
with:
path: 'go/src/github.com/bugsnag/panicwrap' # relative to $GITHUB_WORKSPACE
- name: setup go ${{ matrix.go-version }}
run: |
curl --silent --location --output gimme https://github.com/travis-ci/gimme/raw/v1.5.4/gimme
chmod +x ./gimme
eval "$(./gimme ${{ matrix.go-version }})"
echo "GOOS=" >> $GITHUB_ENV
echo "GOARCH=" >> $GITHUB_ENV
echo "GOROOT=$GOROOT" >> $GITHUB_ENV
echo "PATH=$PATH" >> $GITHUB_ENV
echo "GIMME_ENV=$GIMME_ENV" >> $GITHUB_ENV
echo "GOPATH=$GITHUB_WORKSPACE/go" >> $GITHUB_ENV
- name: set GOPATH
run: echo "GOPATH=$GITHUB_WORKSPACE/go" >> $GITHUB_ENV
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: install dependencies
run: go get -v -d ./...
- name: run tests
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## TBD

### Bug fixes

* Fix windows support by removing undefined syscall

## 1.3.0 (2021-01-05)

### Features
Expand Down
2 changes: 1 addition & 1 deletion dup2.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !arm64
// +build !arm64,!windows

package panicwrap

Expand Down
25 changes: 25 additions & 0 deletions panicwrap_monitor_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// +build !windows

package panicwrap

import (
"bytes"
"strings"
"testing"
)

func TestPanicWrap_monitor(t *testing.T) {

stdout := new(bytes.Buffer)

p := helperProcess("panic-monitor")
p.Stdout = stdout
//p.Stderr = new(bytes.Buffer)
if err := p.Run(); err == nil || err.Error() != "exit status 2" {
t.Fatalf("err: %s", err)
}

if !strings.Contains(stdout.String(), "wrapped:") {
t.Fatalf("didn't wrap: %#v", stdout.String())
}
}
16 changes: 0 additions & 16 deletions panicwrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,22 +409,6 @@ func TestPanicWrap_panicBoundary(t *testing.T) {
}
}

func TestPanicWrap_monitor(t *testing.T) {

stdout := new(bytes.Buffer)

p := helperProcess("panic-monitor")
p.Stdout = stdout
//p.Stderr = new(bytes.Buffer)
if err := p.Run(); err == nil || err.Error() != "exit status 2" {
t.Fatalf("err: %s", err)
}

if !strings.Contains(stdout.String(), "wrapped:") {
t.Fatalf("didn't wrap: %#v", stdout.String())
}
}

func TestWrapped(t *testing.T) {
stdout := new(bytes.Buffer)

Expand Down

0 comments on commit dce6864

Please sign in to comment.