chore(): start moving some packages to the core directory (#7215)
This commit is contained in:
committed by
GitHub
parent
fdee748eed
commit
bbccd6481d
29
packages/cli/medusa-dev-cli/src/utils/promisified-spawn.js
Normal file
29
packages/cli/medusa-dev-cli/src/utils/promisified-spawn.js
Normal file
@@ -0,0 +1,29 @@
|
||||
const execa = require(`execa`)
|
||||
|
||||
const defaultSpawnArgs = {
|
||||
cwd: process.cwd(),
|
||||
stdio: `inherit`,
|
||||
}
|
||||
|
||||
exports.setDefaultSpawnStdio = stdio => {
|
||||
defaultSpawnArgs.stdio = stdio
|
||||
}
|
||||
|
||||
exports.promisifiedSpawn = async ([cmd, args = [], spawnArgs = {}]) => {
|
||||
const spawnOptions = {
|
||||
...defaultSpawnArgs,
|
||||
...spawnArgs,
|
||||
}
|
||||
try {
|
||||
return await execa(cmd, args, spawnOptions)
|
||||
} catch (e) {
|
||||
if (spawnOptions.stdio === `ignore`) {
|
||||
console.log(
|
||||
`\nCommand "${cmd} ${args.join(
|
||||
` `
|
||||
)}" failed.\nTo see details of failed command, rerun "medusa-dev" without "--quiet" or "-q" switch\n`
|
||||
)
|
||||
}
|
||||
throw e
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user