ember-cli / ember-cli/broccoli-babel-transpiler

Worker process not terminated when Babel emits ReferenceError on malformed options

Open
#169 15 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
58
Forks
71
Avg merge
23h 9m
Merged PRs (30d)
2

Description

Consider this snippet based on `broccoli-test-helper`:

```js
let tree = new babel("src", { unknownOption: true })
let output = createBuilder(tree)
try {
await output.build()
} finally {
await output.dispose()
}
```

When the tree is processed, Babel will eventually be handed an options object with an `unknownOption` key and will (rightfully) raise a `ReferenceError`. So far, no surprises.

As a result, however, the worker process where the error was raised doesn't get terminated even after the Broccoli builder has been cleaned up; the parent Node process will not terminate once work has been exhausted.

My guess is that this is caused by `workerpool` and not this package, but I'm not familiar enough with that to know whether it behaves as documented or whether it's bugged. On the other hand, it should be fairly simple to implement a workaround by catching errors in `lib/worker.js`, resolving the promise with the caught error and re-throwing it in `lib/parallel-api.js` → `transformString`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.