Expected Behavior
Given test.mjs
import {$} from 'zx';
const ac = new AbortController();
const {signal} = ac;
for (let i = 0; i < 10; i++) {
$.sync({signal})``; // does nothing
// $.sync({signal})`pwd`; // same result
}
// no MaxListenersExceededWarning
I would expect the signal listener to be released after the subprocess has ended.
Actual Behavior
Executing node test.mjs results in:
(node:49248) MaxListenersExceededWarning: Possible EventTarget memory leak detected. 11 abort listeners
added to [AbortSignal]. MaxListeners is 10. Use events.setMaxListeners() to increase limit
Not specific to sync.
Steps to Reproduce
- Create
test.mjs with the example code
- Run it via
node --trace-warnings test.mjs
- Observe a lovely stack trace blaming
zx/build/vendor-core.cjs:404:25
Specifications
- zx version: v8.1.5
- Platform: macos
- Runtime: node
Expected Behavior
Given
test.mjsI would expect the signal listener to be released after the subprocess has ended.
Actual Behavior
Executing
node test.mjsresults in:Not specific to
sync.Steps to Reproduce
test.mjswith the example codenode --trace-warnings test.mjszx/build/vendor-core.cjs:404:25Specifications