You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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();
});
`
The text was updated successfully, but these errors were encountered:
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();
});
`
The text was updated successfully, but these errors were encountered: