Hi, anyone knows how to use ps.dispose properly ? As I understood it release resources. As per the example below it release only when there are errors. Shouldn’t we also need to release resources when we successfully invoke scripts? Somewhere I also seen use of process.exit() after ps.dispose(). Any good example of uses of this tool will be great help.
`
const shell = require('node-powershell');
let ps = new shell({
executionPolicy: 'Bypass',
noProfile: true
});
ps.addCommand('echo node-powershell')
ps.invoke()
.then(output => {
console.log(output);
//shouldn’t we use ps.dispose() here also??
})
.catch(err => {
console.log(err);
ps.dispose();
});
`
Hi, anyone knows how to use ps.dispose properly ? As I understood it release resources. As per the example below it release only when there are errors. Shouldn’t we also need to release resources when we successfully invoke scripts? Somewhere I also seen use of process.exit() after ps.dispose(). Any good example of uses of this tool will be great help.
` const shell = require('node-powershell');
let ps = new shell({ executionPolicy: 'Bypass', noProfile: true });
ps.addCommand('echo node-powershell') ps.invoke() .then(output => { console.log(output); //shouldn’t we use ps.dispose() here also?? }) .catch(err => { console.log(err); ps.dispose(); }); `