Call one too from another in asdf

19 views Asked by At

I'm running into a situation where one tool needs to spawn a child_process using another tool.

For example, my .tool-versions file looks like this:

java adoptopenjdk-21.0.0+35.0.LTS
nodejs 20.11.0

Both node --version and java --version work as expected. However, when I run the following js script:

const { spawn } = require("child_process");

spawn("java", [], {
  env: {
    PATH: process.env.PATH,
  },
  stdio: "inherit",
)

It prints

unknown command: java. Perhaps you have to reshim?

Can one tool call another tool like this?

0

There are 0 answers