diff --git a/pkg/diag/colors/windows.go b/pkg/diag/colors/windows.go new file mode 100644 index 000000000..7d31d1bd5 --- /dev/null +++ b/pkg/diag/colors/windows.go @@ -0,0 +1,13 @@ +// Copyright 2016-2017, Pulumi Corporation. All rights reserved. + +//+build windows + +package colors + +import ( + "github.com/reconquest/loreley" +) + +func init() { + loreley.Colorize = loreley.ColorizeNever +} diff --git a/pkg/resource/deploy/source_eval.go b/pkg/resource/deploy/source_eval.go index 712461f2a..60e38eeac 100644 --- a/pkg/resource/deploy/source_eval.go +++ b/pkg/resource/deploy/source_eval.go @@ -201,7 +201,7 @@ func newResourceMonitor(reschan chan *evalSourceGoal) (*resmon, error) { return nil, err } - resmon.addr = fmt.Sprintf("0.0.0.0:%d", port) + resmon.addr = fmt.Sprintf("127.0.0.1:%d", port) resmon.done = done return resmon, nil diff --git a/pkg/resource/plugin/host_server.go b/pkg/resource/plugin/host_server.go index 03ddd8bca..19128ba49 100644 --- a/pkg/resource/plugin/host_server.go +++ b/pkg/resource/plugin/host_server.go @@ -44,7 +44,7 @@ func newHostServer(host Host, ctx *Context) (*hostServer, error) { return nil, err } - engine.addr = fmt.Sprintf("0.0.0.0:%d", port) + engine.addr = fmt.Sprintf("127.0.0.1:%d", port) engine.done = done return engine, nil diff --git a/pkg/util/rpcutil/serve.go b/pkg/util/rpcutil/serve.go index 54bc940c0..577ba5b36 100644 --- a/pkg/util/rpcutil/serve.go +++ b/pkg/util/rpcutil/serve.go @@ -30,7 +30,7 @@ func IsBenignCloseErr(err error) bool { // the server is finished, in the case of a successful launch of the RPC server. func Serve(port int, cancel chan bool, registers []func(*grpc.Server) error) (int, chan error, error) { // Listen on a TCP port, but let the kernel choose a free port for us. - lis, err := net.Listen("tcp", ":"+strconv.Itoa(port)) + lis, err := net.Listen("tcp", "127.0.0.1:"+strconv.Itoa(port)) if err != nil { return port, nil, errors.Errorf("failed to listen on TCP port ':%v': %v", port, err) } diff --git a/sdk/nodejs/runtime/native/binding.gyp b/sdk/nodejs/runtime/native/binding.gyp index c909f5090..a4aed0de3 100644 --- a/sdk/nodejs/runtime/native/binding.gyp +++ b/sdk/nodejs/runtime/native/binding.gyp @@ -5,8 +5,19 @@ "sources": [ "closure.cc" ], - "include_dirs": [ - " Lookup(Isolate* isolate, v8::internal::Handle(); } +// MSVC 2015 (which we build with on Windows) does not treat strlen of a literal as a constexpr, +// so we can't use it to intialize our buffer size. So instead, we use sizeof() to compute the +// length, so we need a literal string instead of just a const char*. +#define BAD_PREFIX "[Function:" +#define STRLEN_LITERAL_ONLY(S) (sizeof((S))/sizeof(char) - 1) + Local SerializeFunctionCode(Isolate *isolate, Local func) { // Serialize the code simply by calling toString on the Function. Local toString = Local::Cast( @@ -84,12 +90,11 @@ Local SerializeFunctionCode(Isolate *isolate, Local func) { Local code = Local::Cast(toString->Call(func, 0, nullptr)); // Ensure that the code is a function expression (including arrows), and not a definition, etc. - const char* badprefix = "[Function:"; - size_t badprefixLength = strlen(badprefix); + constexpr size_t badprefixLength = STRLEN_LITERAL_ONLY(BAD_PREFIX); if (code->Length() >= (int)badprefixLength) { char buf[badprefixLength]; code->WriteUtf8(buf, badprefixLength); - if (!strncmp(badprefix, buf, badprefixLength)) { + if (!strncmp(BAD_PREFIX, buf, badprefixLength)) { isolate->ThrowException(Exception::TypeError( String::NewFromUtf8(isolate, "Cannot serialize non-expression functions (such as definitions and generators)"))); @@ -101,6 +106,8 @@ Local SerializeFunctionCode(Isolate *isolate, Local func) { String::Concat(String::NewFromUtf8(isolate, "("), code), String::NewFromUtf8(isolate, ")")); } +#undef BAD_PREFIX +#undef STRLEN_LITERAL_ONLY // SerializeFunction serializes a JavaScript function expression and its associated closure environment. Local SerializeFunction(Isolate *isolate, Local func,