-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(docz-core): forward cli status code properly (#1319)
- Loading branch information
1 parent
29e0165
commit 99ebf82
Showing
3 changed files
with
17 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import spawn from 'cross-spawn' | ||
import sh from 'shelljs' | ||
|
||
import * as paths from '../config/paths' | ||
import { spawnSync } from '../utils/spawn' | ||
|
||
export const serve = async () => { | ||
const cliArgs = ['run', 'serve'] | ||
sh.cd(paths.docz) | ||
spawn.sync('npm', cliArgs, { stdio: 'inherit' }) | ||
spawnSync('npm', cliArgs) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import crossSpawn from 'cross-spawn' | ||
|
||
export const spawnSync = (command: string, args?: readonly string[]) => { | ||
const output = crossSpawn.sync(command, args, { | ||
stdio: ['inherit', 'inherit', 'pipe'], | ||
}) | ||
|
||
if (!output.stderr) { | ||
return | ||
} | ||
|
||
process.exitCode = output.status || 1 | ||
} |