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

Persistent PowerShell Issue with systeminformation Module #907

Open
narmatha291289 opened this issue Apr 23, 2024 · 1 comment
Open

Persistent PowerShell Issue with systeminformation Module #907

narmatha291289 opened this issue Apr 23, 2024 · 1 comment

Comments

@narmatha291289
Copy link

Issue Description:

I'm encountering an issue while working with persistent PowerShell in the systeminformation module. When I call si.getStaticData() immediately after initializing the PowerShell, it works as expected. However, if I call it after some other si functions, it doesn't return the expected output. Execution halts thereafter.

Code Snippet:

javascript

const si = require("systeminformation");

async function fetchData() {

    try {
        await si.powerShellStart();

        const staticData = await si.getStaticData();
        console.log("Static Data:", JSON.stringify(staticData));

        const osInfo = await si.osInfo();
        console.log("OS Info:", JSON.stringify(osInfo));

        const systemInfo = await si.system();
        console.log("System Info:", JSON.stringify(systemInfo));

        const staticData_1 = await si.getStaticData();
        console.log("Static Data-1:", JSON.stringify(staticData_1));

        return { staticData, osInfo, systemInfo, staticData_1 };

    } catch (error) {

        console.error("Error fetching data:", error);
        return null;
    }
}

fetchData();

Issue Details:

After investigating, I found that si.getStaticData() behaves inconsistently. It returns the output correctly when called immediately after initializing the PowerShell, but not when called after other si functions.

Steps to Reproduce:

  1. Initialize the PowerShell with si.powerShellStart().
  2. Call si.getStaticData() after some other si functions, such as si.osInfo() and si.system().
  3. Note that si.getStaticData() does not return the expected output.

Expected Behavior:

I expect si.getStaticData() to return the correct output regardless of its position in the code and after other si function calls.

Additional Information:

Environment: Windows 10; Node - v18.20.2; PowerShell - v5.1.19041.4170
systeminformation version: 5.22.5

Any guidance on resolving this issue would be greatly appreciated. If I've overlooked any mistakes or if there's additional information needed, please let me know. Thank you for your assistance!

@narmatha291289
Copy link
Author

@sebhildebrandt , I would greatly appreciate any guidance on resolving this issue. It would be very helpful for me. If I've missed any errors or if additional information is needed, please let me know. Thank you for your assistance!

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

No branches or pull requests

1 participant