Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

powerShellStart that return Promise #911

Open
xoxloviwan opened this issue Jun 5, 2024 · 1 comment
Open

powerShellStart that return Promise #911

xoxloviwan opened this issue Jun 5, 2024 · 1 comment

Comments

@xoxloviwan
Copy link

Is your feature request related to a problem? Please describe.
powerShellStart() and powerShellRelease() functions start and close a PowerShell process that may be running after some time (especialy on weak PC). Now in promise chain I can't get any status of running; and I can't know when PowerShell process was ready to work.

Describe the solution you'd like
remake current functions or add new Promise-based variant of reailzation powerShellStart() that allow run this way:

     let specs = [ 'system', 'diskLayout', 'graphics' ];
     si.powerShellStartPromisify()
       .then(() => Promise.all(specs.map(async (item) => (info[item] = await si[item]())));

Describe alternatives you've considered
Now I have to write something like this:

     let specs = [ 'system', 'diskLayout', 'graphics' ];
     new Promise((resolve) => {
            si.powerShellStart();
            setTimeout(() => resolve(), 1000);
     })
    .then(() => Promise.all(specs.map(async (item) => (info[item] = await si[item]())));
@sebhildebrandt
Copy link
Owner

@xoxloviwan This is a good idea! Will implement it the upcoming days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants