Skip to content

Executing node_binary clobbers current working directory #36

@driveraid

Description

@driveraid

Hi,
We're using a node binary to implement a small IDL compiler:

node_binary(
    name = "gen",
    srcs = [...]
    ...)

The binary gets used later in a genrule, something like this:

genrule(
    name = "gen_osl",
    srcs = ["example/file.idl"],
    tools = [":gen"],
    cmd = "$(location :gen) ...options... $(location example/file.idl)",
    ...)

However, we find that the generated runner for the gen target has the following content,

#!/usr/bin/env bash
set -e
ROOT=$(dirname $0)
export PATH="$ROOT:$PATH"
cd $ROOT/gen_bundle && exec node node_modules/platform/tools/reaktor/gen_module $@
  1. Is there a special reason as to why to chdir into the gen_bundle directory? It destroys our ability to locate the source file.
  2. Do you know of some other way I could work around?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions