| ... | ... |
@@ -4,7 +4,9 @@ import ( |
| 4 | 4 |
"bytes" |
| 5 | 5 |
"container/list" |
| 6 | 6 |
"io" |
| 7 |
+ "os" |
|
| 7 | 8 |
"os/exec" |
| 9 |
+ "path/filepath" |
|
| 8 | 10 |
"sync" |
| 9 | 11 |
) |
| 10 | 12 |
|
| ... | ... |
@@ -34,6 +36,19 @@ func Tar(path string) (io.Reader, error) {
|
| 34 | 34 |
return output, nil |
| 35 | 35 |
} |
| 36 | 36 |
|
| 37 |
+// Figure out the absolute path of our own binary |
|
| 38 |
+func SelfPath() string {
|
|
| 39 |
+ path, err := exec.LookPath(os.Args[0]) |
|
| 40 |
+ if err != nil {
|
|
| 41 |
+ panic(err) |
|
| 42 |
+ } |
|
| 43 |
+ path, err = filepath.Abs(path) |
|
| 44 |
+ if err != nil {
|
|
| 45 |
+ panic(err) |
|
| 46 |
+ } |
|
| 47 |
+ return path |
|
| 48 |
+} |
|
| 49 |
+ |
|
| 37 | 50 |
type nopWriteCloser struct {
|
| 38 | 51 |
io.Writer |
| 39 | 52 |
} |