🎨 Continue using npm
This commit is contained in:
9
bin/utils/shell.ts
vendored
9
bin/utils/shell.ts
vendored
@@ -1,13 +1,18 @@
|
||||
import { execa } from 'execa';
|
||||
import { npmDirectory } from './dir';
|
||||
|
||||
export async function shellExec(command: string, timeout: number = 300000) {
|
||||
export async function shellExec(
|
||||
command: string,
|
||||
timeout: number = 300000,
|
||||
env?: Record<string, string>,
|
||||
) {
|
||||
try {
|
||||
const { exitCode } = await execa(command, {
|
||||
cwd: npmDirectory,
|
||||
stdio: 'inherit',
|
||||
stdio: ['inherit', 'pipe', 'inherit'], // Hide stdout verbose, keep stderr
|
||||
shell: true,
|
||||
timeout,
|
||||
env: env ? { ...process.env, ...env } : process.env,
|
||||
});
|
||||
return exitCode;
|
||||
} catch (error: any) {
|
||||
|
||||
Reference in New Issue
Block a user