pulumi/sdk/nodejs/bin/pulumi-provider-pulumi-nodejs.cmd
Matt Ellis 3fcf5889c1 Don't change cd in Windows launch scripts
Previously, we would CD into the directory of the launch script and
invoke node.exe from there. We did this because the require statement
was a relative path and so we needed to be in the langhost directory for
things to work.

This behavior differs from how we launch things on *nix and was causing
some issues with relative paths, since the CWD would now differ between
Windows and *nix. So instead we construct a full path for our require
statements and don't cd anymore. The only tricky thing is to change path
separators from \ to / when computing the path to the root folder we
should do our require from.
2017-10-30 15:37:06 -07:00

12 lines
535 B
Batchfile

@echo off
SET REQUIRE_ROOT=%~dp0
SET REQUIRE_ROOT=%REQUIRE_ROOT:\=/%
REM We depend on a custom node build that has exposed some internal state
REM This node is downloaded and extracted via the EnsureCustomNode target
REM in the root build.proj
REM
REM NOTE: we pass a dummy argument before the actual args because the
REM provider module expects to be invoked as `node path/to/provider args`,
REM but we are invoking it with `-e`.
"%~dp0\..\custom_node\node.exe" -e "require('%REQUIRE_ROOT%./cmd/dynamic-provider');" dummy_argument %*