Skip to content

Commit

Permalink
fix: check RUNFILES env variable in @bazel/runfiles helper (#3602)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregmagolan authored Nov 23, 2022
1 parent 724ede3 commit 11395ea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion internal/runfiles/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,11 @@ class Runfiles {
else if (!!_env['RUNFILES_DIR']) {
this.runfilesDir = path__default['default'].resolve(_env['RUNFILES_DIR']);
}
else if (!!_env['RUNFILES']) {
this.runfilesDir = path__default['default'].resolve(_env['RUNFILES']);
}
else {
throw new Error('Every node program run under Bazel must have a $RUNFILES_DIR or $RUNFILES_MANIFEST_FILE environment variable');
throw new Error('Every node program run under Bazel must have a $RUNFILES_DIR, $RUNFILES or $RUNFILES_MANIFEST_FILE environment variable');
}
// Under --noenable_runfiles (in particular on Windows)
// Bazel sets RUNFILES_MANIFEST_ONLY=1.
Expand Down
4 changes: 3 additions & 1 deletion packages/runfiles/runfiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ export class Runfiles {
this.manifest = this.loadRunfilesManifest(_env['RUNFILES_MANIFEST_FILE']!);
} else if (!!_env['RUNFILES_DIR']) {
this.runfilesDir = path.resolve(_env['RUNFILES_DIR']!);
} else if (!!_env['RUNFILES']) {
this.runfilesDir = path.resolve(_env['RUNFILES']!);
} else {
throw new Error(
'Every node program run under Bazel must have a $RUNFILES_DIR or $RUNFILES_MANIFEST_FILE environment variable');
'Every node program run under Bazel must have a $RUNFILES_DIR, $RUNFILES or $RUNFILES_MANIFEST_FILE environment variable');
}
// Under --noenable_runfiles (in particular on Windows)
// Bazel sets RUNFILES_MANIFEST_ONLY=1.
Expand Down

0 comments on commit 11395ea

Please sign in to comment.