Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set ESBUILD_BINARY_PATH to empty path will cause ebuild hang #2129

Closed
hardfist opened this issue Mar 25, 2022 · 1 comment
Closed

set ESBUILD_BINARY_PATH to empty path will cause ebuild hang #2129

hardfist opened this issue Mar 25, 2022 · 1 comment

Comments

@hardfist
Copy link
Contributor

hardfist commented Mar 25, 2022

when I debug local build esbuild , I often need to set ESBUILD_BINARY_PATH to local build esbuild path, but sometimes I may set it wrongly or accidently clean esbuild, then esbuild build or transform will hang.
I found the this may be related to the following code
main.js

 let child = child_process.spawn(command, args.concat(`--service=${"0.14.25"}`, "--ping"), {
    windowsHide: true,
    stdio: ["pipe", "pipe", "inherit"],
    cwd: defaultWD
  });
  let { readFromStdout, afterClose, service } = createChannel({
    writeToStdin(bytes) {
      child.stdin.write(bytes, (err) => {
        if (err)
          afterClose();
      });
    },
    readFileSync: fs2.readFileSync,
    isSync: false,
    isBrowser: false,
    esbuild: node_exports
  });
  child.on('error', (err) => {
    console.log('err:',err) // triggered when child_process failed
  })
  child.stdin.on("error", afterClose); // not triggered when child_process failed
  const stdin = child.stdin;
  const stdout = child.stdout;

It seems that esbuild doesn't handle child_process exception properly.

@evanw
Copy link
Owner

evanw commented Mar 25, 2022

If you're using esbuild's synchronous API calls, you may be able to work around this with ESBUILD_WORKER_THREADS=0 in the meantime.

@evanw evanw closed this as completed in 2151135 Mar 26, 2022
zhusjfaker pushed a commit to speedy-js/esbuild that referenced this issue Mar 28, 2022
hardfist pushed a commit to speedy-js/esbuild that referenced this issue Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants