Skip to content

Commit

Permalink
Merge pull request #39 from mattn/windows
Browse files Browse the repository at this point in the history
support windows
  • Loading branch information
gravityblast committed Sep 30, 2015
2 parents 2f15c05 + 5d99b7a commit e507568
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 14 deletions.
17 changes: 17 additions & 0 deletions runner/limit_unix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// +build !windows

package runner

import (
"syscall"
)

func initLimit() {
var rLimit syscall.Rlimit
rLimit.Max = 10000
rLimit.Cur = 10000
err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rLimit)
if err != nil {
fmt.Println("Error Setting Rlimit ", err)
}
}
6 changes: 6 additions & 0 deletions runner/limit_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// +build windows

package runner

func initLimit() {
}
5 changes: 3 additions & 2 deletions runner/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package runner
import (
"fmt"
logPkg "log"
"os"
"time"

"github.com/mattn/go-colorable"
)

type logFunc func(string, ...interface{})

var logger = logPkg.New(os.Stderr, "", 0)
var logger = logPkg.New(colorable.NewColorableStderr(), "", 0)

func newLogFunc(prefix string) func(string, ...interface{}) {
color, clear := "", ""
Expand Down
7 changes: 6 additions & 1 deletion runner/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/pilu/config"
"os"
"path/filepath"
"runtime"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -116,7 +117,11 @@ func buildName() string {
return settings["build_name"]
}
func buildPath() string {
return filepath.Join(tmpPath(), buildName())
p := filepath.Join(tmpPath(), buildName())
if runtime.GOOS == "windows" && filepath.Ext(p) != ".exe" {
p += ".exe"
}
return p
}

func buildErrorsFileName() string {
Expand Down
11 changes: 0 additions & 11 deletions runner/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"os"
"runtime"
"strings"
"syscall"
"time"
)

Expand Down Expand Up @@ -88,16 +87,6 @@ func initLogFuncs() {
appLog = newLogFunc("app")
}

func initLimit() {
var rLimit syscall.Rlimit
rLimit.Max = 10000
rLimit.Cur = 10000
err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rLimit)
if err != nil {
fmt.Println("Error Setting Rlimit ", err)
}
}

func setEnvVars() {
os.Setenv("DEV_RUNNER", "1")
wd, err := os.Getwd()
Expand Down

0 comments on commit e507568

Please sign in to comment.