Skip to content

Commit

Permalink
build: remove osext dependency (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
kattrali authored Jan 11, 2021
1 parent d621ed7 commit d4891a2
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
9 changes: 9 additions & 0 deletions exec.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// +build go1.8

package panicwrap

import "os"

func Executable() (string, error) {
return os.Executable()
}
9 changes: 9 additions & 0 deletions exec_old.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// +build !go1.8

package panicwrap

import "github.com/kardianos/osext"

func Executable() (string, error) {
return osext.Executable()
}
3 changes: 1 addition & 2 deletions monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
package panicwrap

import (
"github.com/kardianos/osext"
"os"
"os/exec"
)
Expand All @@ -29,7 +28,7 @@ func monitor(c *WrapConfig) (int, error) {
os.Exit(0)
}

exePath, err := osext.Executable()
exePath, err := Executable()
if err != nil {
return -1, err
}
Expand Down
3 changes: 1 addition & 2 deletions panicwrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ package panicwrap
import (
"bytes"
"errors"
"github.com/kardianos/osext"
"io"
"os"
"os/exec"
Expand Down Expand Up @@ -143,7 +142,7 @@ func wrap(c *WrapConfig) (int, error) {
}

// Get the path to our current executable
exePath, err := osext.Executable()
exePath, err := Executable()
if err != nil {
return -1, err
}
Expand Down

0 comments on commit d4891a2

Please sign in to comment.