refactor(dev-infra): use the exec()
helper from utils/shelljs
whenever possible (#37444)
There is an `exec()` helper provided by `utils/shelljs.ts`, which is a wrapper around ShellJS' `exec()` with some default options (currently `silent: true`). The intention is to avoid having to pass these options to every invocation of the `exec()` function. This commit updates all code inside `dev-infra/` to use this helper whenever possible). NOTE: For simplicity, the `utils/shelljs` helper does not support some of the less common call signatures of the original `exec()` helper, so in some cases we still need to use the original. PR Close #37444
This commit is contained in:
@ -8,9 +8,9 @@
|
||||
|
||||
import {existsSync} from 'fs';
|
||||
import {dirname, join} from 'path';
|
||||
import {exec} from 'shelljs';
|
||||
|
||||
import {error} from './console';
|
||||
import {exec} from './shelljs';
|
||||
import {isTsNodeAvailable} from './ts-node';
|
||||
|
||||
/**
|
||||
@ -119,7 +119,7 @@ export function assertNoErrors(errors: string[]) {
|
||||
|
||||
/** Gets the path of the directory for the repository base. */
|
||||
export function getRepoBaseDir() {
|
||||
const baseRepoDir = exec(`git rev-parse --show-toplevel`, {silent: true});
|
||||
const baseRepoDir = exec(`git rev-parse --show-toplevel`);
|
||||
if (baseRepoDir.code) {
|
||||
throw Error(
|
||||
`Unable to find the path to the base directory of the repository.\n` +
|
||||
|
Reference in New Issue
Block a user