pidtree icon indicating copy to clipboard operation
pidtree copied to clipboard

Error: spawn wmic ENOENT on Windows Server 2025

Open MikeMcC399 opened this issue 10 months ago • 0 comments

  • This is a duplicate of https://github.com/simonepri/pidtree/issues/20 adding information for Windows Server 2025

pidtree has a dependency on the deprecated Windows Management Instrumentation command-line (WMIC) utility

Issue

pidtree fails under GitHub Actions windows-2025 with the error

Error: spawn wmic ENOENT

pidtree depends on wmic.

For Microsoft Windows Servers, wmic has been deprecated since 2016 and it is not installed by default on Windows Server 2025 (see Features we're no longer developing).

The GitHub Actions runner image windows-2025, currently in beta status, does not include WMIC and there are no plans to add it. (See Windows Server 2025 is now in public preview).

Steps to reproduce

Run the following workflow in this repo in GitHub Actions

name: test-windows

on:  [workflow_dispatch]

jobs:
  test:
    runs-on: windows-2025
    steps:
      - name: Setup repo
        uses: actions/checkout@v4
      - name: Setup node 22
        uses: actions/setup-node@v4
        with:
          node-version: 22
      - name: Install dependencies
        run:  npm install
      - name: Run tests
        run: npm run test:windows

Logs

Run npm run test:windows

> [email protected] test:windows
> ava -m "!*benchmark*"


  × integration » should use the callback if it's provided Callback called with an error
  × integration » should work with a single pid Rejected promise returned by test
  × integration » should throw an error if the pid does not exists
  √ integration » should throw an error if an invalid pid is provided
  × integration » show work with a Parent process which has zero Child processes Rejected promise returned by test
  × integration » show include the root if the root option is passsed Rejected promise returned by test
  √ wmic » should parse wmic output on Windows
  × integration » show work with a Parent process which has ten Child processes Rejected promise returned by test
  √ ps » should parse ps output on Darwin
  √ ps » should parse ps output on *nix
  √ ps » should not throw if stderr contains the "bogus screen" error message
  √ ps » should throw if stderr contains an error

  6 tests failed

  integration » should use the callback if it's provided

  D:\a\pidtree\pidtree\lib\pidtree.js:32

   31:     if (err) {
   32:       callback(err);
   33:       return;

  Callback called with an error:

  Error {
    message: 'Error: spawn wmic ENOENT',
  }



  integration » should work with a single pid

  D:\a\pidtree\pidtree\lib\bin.js:45

   44:     executed = true;
   45:     done(new Error(err));
   46:   });

  Rejected promise returned by test. Reason:

  Error {
    message: 'Error: spawn wmic ENOENT',
  }



  integration » should throw an error if the pid does not exists

  D:\a\pidtree\pidtree\test\integration.js:124

   123:   const err = await t.throws(pidtree(65535));
   124:   t.is(err.message, 'No matching pid found');
   125: });

  Difference:

  - 'Error: spawn wmic ENOENT'
  + 'No matching pid found'



  integration » show work with a Parent process which has zero Child processes

  D:\a\pidtree\pidtree\lib\bin.js:45

   44:     executed = true;
   45:     done(new Error(err));
   46:   });

  Rejected promise returned by test. Reason:

  Error {
    message: 'Error: spawn wmic ENOENT',
  }



  integration » show include the root if the root option is passsed

  D:\a\pidtree\pidtree\lib\bin.js:45

   44:     executed = true;
   45:     done(new Error(err));
   46:   });

  Rejected promise returned by test. Reason:

  Error {
    message: 'Error: spawn wmic ENOENT',
  }



  integration » show work with a Parent process which has ten Child processes

  D:\a\pidtree\pidtree\lib\bin.js:45

   44:     executed = true;
   45:     done(new Error(err));
   46:   });

  Rejected promise returned by test. Reason:

  Error {
    message: 'Error: spawn wmic ENOENT',
  }



  The .only() modifier is used in some tests. 1 test was not run

Error: Process completed with exit code 1.

MikeMcC399 avatar Dec 19 '24 20:12 MikeMcC399