child-shell: MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 data listeners added. Use emitter.setMaxListeners() to increase limit
The code will cause this.streams.stderr to repeatedly listen for the same event:
const Shell = require("node-powershell");
const test = async () => {
const ps = new Shell({
executionPolicy: "Bypass",
noProfile: true
})
for (let index = 0; index < 10; index++) {
ps.addCommand(`echo ${index}`)
const res = await ps.invoke()
console.log("im index and res: %n %s", index, res)
}
}
test()

I have noticed that every time you run the invoke function, you will recreate the ShellStreamBuffer instance, this should be optimizable. https://github.com/rannn505/node-powershell/blob/b0a0f7f33f7c0b07351e875007e97a20d217b420/lib/Shell.js#L180
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 6
- Comments: 15 (6 by maintainers)
Commits related to this issue
- fix bug #84 — committed to I-Want-ToBelieve/node-powershell by I-Want-ToBelieve 5 years ago
- Fix bug #84 #96 — committed to davistran86/node-powershell by deleted user 5 years ago
@FloatingShuYin @zenion , A fix will be released with the next version. working on that π
Thanks @rannn505 for your work! I am looking forward to giving 5.0.1 a spin π
@sopelt
Regarding the name thing, this version I implemented the NPS base classes with an abstract layer that would now allow me to apply a cover to any other shell I want quite easily and fast. The name of the package will not change but new packages (like node-bash etc β¦) will be added very soon. All of them will be here in this repo (and I plan to use lerna to manage all the new packages). it will be fun π
@sopelt, I still have some small things left before I can release, but I wonβt have enough time to fix them today. I believe it will be released tomorrow. Thank you for your patience.
@sopelt, Iβm aiming for this Saturday π€