Skip to content

Commit 5c22014

Browse files
committed
Make grafsy windows compatible
1 parent 4dc6d83 commit 5c22014

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ build/$(NAME): $(NAME)/main.go
4949
build/$(NAME)-client: $(NAME)-client/main.go
5050
$(GO_BUILD)
5151

52+
build/$(NAME).exe: $(NAME)/main.go
53+
GOOS=windows $(GO_BUILD)
54+
55+
build/$(NAME)-client.exe: $(NAME)-client/main.go
56+
GOOS=windows $(GO_BUILD)
57+
5258
#########################################################
5359
# Prepare artifact directory and set outputs for upload #
5460
#########################################################

config.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ package grafsy
22

33
import (
44
"fmt"
5-
"github.com/BurntSushi/toml"
6-
"github.com/pkg/errors"
75
"log"
86
"net"
97
"os"
108
"path/filepath"
119
"regexp"
1210
"strings"
13-
"syscall"
11+
12+
"github.com/BurntSushi/toml"
13+
"github.com/pkg/errors"
1414
)
1515

1616
// ConfigPath is the default path to the configuration file
@@ -170,14 +170,12 @@ func (conf *Config) prepareEnvironment() error {
170170
Check if directories for temporary files exist.
171171
This is especially important when your metricDir is in /tmp.
172172
*/
173-
oldUmask := syscall.Umask(0)
174173

175174
if _, err := os.Stat(conf.MetricDir); os.IsNotExist(err) {
176175
os.MkdirAll(conf.MetricDir, 0777|os.ModeSticky)
177176
} else {
178177
os.Chmod(conf.MetricDir, 0777|os.ModeSticky)
179178
}
180-
syscall.Umask(oldUmask)
181179

182180
/*
183181
Unfortunately some people write to MetricDir with random permissions.

config_windows.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
config_freebsd.go

0 commit comments

Comments
 (0)