New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build error on Windows due to syscall package. #697

Merged
merged 1 commit into from Sep 6, 2017
Jump to file or symbol
Failed to load files and symbols.
+23 −3
Diff settings

Always

Just for now

@@ -0,0 +1,13 @@
// +build !windows
// Package sysutil contains system-specific utilities.
package sysutil
import "golang.org/x/sys/unix"
// RlimitStack reports the current stack size limit in bytes.
func RlimitStack() (cur uint64, err error) {
var r unix.Rlimit
err = unix.Getrlimit(unix.RLIMIT_STACK, &r)
return r.Cur, err
}
@@ -0,0 +1,7 @@
package sysutil
import "errors"
func RlimitStack() (uint64, error) {
return 0, errors.New("RlimitStack is not implemented on Windows")
}
View
@@ -31,6 +31,7 @@ import (
gbuild "github.com/gopherjs/gopherjs/build"
"github.com/gopherjs/gopherjs/compiler"
"github.com/gopherjs/gopherjs/internal/sysutil"
"github.com/kisielk/gotool"
"github.com/neelance/sourcemap"
"github.com/spf13/cobra"
@@ -765,12 +766,11 @@ func runNode(script string, args []string, dir string, quiet bool) error {
//
// ulimit -s 10000 && gopherjs test
//
var r syscall.Rlimit
err := syscall.Getrlimit(syscall.RLIMIT_STACK, &r)
cur, err := sysutil.RlimitStack()
if err != nil {
return fmt.Errorf("failed to get stack size limit: %v", err)
}
allArgs = append(allArgs, fmt.Sprintf("--stack_size=%v", r.Cur/1000)) // Convert from bytes to KB.
allArgs = append(allArgs, fmt.Sprintf("--stack_size=%v", cur/1000)) // Convert from bytes to KB.
}
allArgs = append(allArgs, script)
ProTip! Use n and p to navigate between commits in a pull request.