Skip to content

Commit

Permalink
fix(@angular/cli): ng doc does open browser on Windows
Browse files Browse the repository at this point in the history
Wait until the browser has been launched before exiting the Node.js process.

For more about this change see the explanation #22257 (comment)

Closes #22257
  • Loading branch information
alan-agius4 authored and dgp1130 committed Dec 2, 2021
1 parent d111ade commit 0b6071a
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions packages/angular/cli/commands/doc-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,13 @@ export class DocCommand extends Command<DocCommandSchema> {
/* eslint-disable-next-line import/no-extraneous-dependencies */
const currentNgVersion = (await import('@angular/core')).VERSION.major;
domain = `v${currentNgVersion}.angular.io`;
} catch (e) {}
} catch {}
}

let searchUrl = `https://${domain}/api?query=${options.keyword}`;

if (options.search) {
searchUrl = `https://${domain}/docs?search=${options.keyword}`;
}

await open(searchUrl, {
wait: false,
});
await open(
options.search
? `https://${domain}/api?query=${options.keyword}`
: `https://${domain}/docs?search=${options.keyword}`,
);
}
}

0 comments on commit 0b6071a

Please sign in to comment.