Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fc9218c

Browse files
committed
capture error on command failure
Signed-off-by: shmck <[email protected]>
1 parent 2b3a672 commit fc9218c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

scripts/build.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ cd web-app
2828
yarn build
2929
cd ..
3030

31-
# For Windows build: switch the next 2 lines
3231
echo "Bundling webapp..."
3332
if [[ "$OSTYPE" == "msys" ]]; then
3433
# linux subsystem on windows selected

src/services/hooks/utils/runCommands.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@ const runCommands = async (commands: string[] = []): Promise<void> => {
1111
title: command,
1212
description: 'Running process...',
1313
}
14+
logger(`Command: ${command}`)
1415
send({ type: 'COMMAND_START', payload: { process: { ...process, status: 'RUNNING' } } })
1516
let result: { stdout: string; stderr: string }
1617
try {
1718
result = await exec({ command })
18-
logger(`Command output: ${JSON.stringify(result)}`)
19+
if (result.stderr) {
20+
throw new Error(result.stderr)
21+
}
22+
logger(`Command output: ${result.stdout}`)
1923
} catch (error: any) {
2024
logger(`Command failed: ${error.message}`)
2125
send({ type: '', payload: { process: { ...process, status: 'FAIL' } } })

0 commit comments

Comments
 (0)