Skip to content

completion.ts: hasGlobalCliInstall requires "which" #23997

Closed
@tjni

Description

@tjni

Command

build

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

When which does not exist on the path, hasGlobalCliInstall does not resolve its promise. Then, maybe due to nodejs/node#22088, the process exits prematurely.

Minimal Reproduction

I got here running ng build from a nixpkgs build of PeerTube, which has a lot of layers, but this phenomenon of early exiting can be reproduced with a simple example:

const { execFile } = require('child_process');

(async function main () {
  const proc = execFile("blah");

  const exitCode = await new Promise((resolve) => {
    proc.addListener('exit', (exitCode) => {
      resolve(exitCode);
    });
  });

  console.log("Exit code:", exitCode);
})();

Exception or Error

No response

Your Environment

❯ node_modules/.bin/ng version                                                                                                         took 19s

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 14.2.2
Node: 18.9.0 (Unsupported)
Package Manager: yarn 1.22.19
OS: darwin arm64

Angular: 14.2.1
... animations, cdk, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic, router
... service-worker

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1402.2
@angular-devkit/build-angular   14.2.2
@angular-devkit/core            14.2.2
@angular-devkit/schematics      14.2.2
@angular/cli                    14.2.2
@schematics/angular             14.2.2
rxjs                            7.5.6
typescript                      4.8.3
webpack                         5.74.0

Anything else relevant?

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions