blob: a562b19fdf7535a9f19cdfbc4a42b9681b9e36a0 [file]
const { Runfiles } = require('@bazel/runfiles')
const { execFileSync } = require('child_process')
// Verify RUNFILES_DIR is set in this (outer) process
const runfiles = new Runfiles(process.env)
// Locate the inner js_binary via runfiles and exec it, passing args through.
// The inner binary also uses @bazel/runfiles, so this tests that RUNFILES_DIR
// set by the outer process is inherited and usable by the inner process.
const innerBinary = runfiles.resolve(
'examples/runfiles/test_binary_/test_binary'
)
const result = execFileSync(innerBinary, process.argv.slice(2), {
encoding: 'utf8',
})
process.stdout.write(result)