17 lines
400 B
TypeScript
Vendored
17 lines
400 B
TypeScript
Vendored
import { execa } from 'execa';
|
|
import { npmDirectory } from './dir';
|
|
|
|
export async function shellExec(command: string) {
|
|
try {
|
|
const { exitCode } = await execa(command, {
|
|
cwd: npmDirectory,
|
|
stdio: 'inherit',
|
|
});
|
|
return exitCode;
|
|
} catch (error) {
|
|
throw new Error(
|
|
`Error occurred while executing command "${command}". Exit code: ${error.exitCode}`,
|
|
);
|
|
}
|
|
}
|