Skip to content

Commit 170c250

Browse files
committed
Throw Error.
1 parent f4ac441 commit 170c250

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

lib/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,13 @@ var defaultOptions = {
147147
onBuildEnd: [],
148148
onBuildExit: [],
149149
dev: true,
150+
throwOnExecError: false,
150151
verbose: false
151152
};
152153

153154
function puts(error, stdout, stderr) {
154155
if (error) {
155-
console.log('Error: ', error, stderr);
156+
throw error;
156157
}
157158
}
158159

@@ -177,7 +178,6 @@ function handleScript(script) {
177178
args = _serializeScript.args;
178179

179180
var proc = spawn(command, args, { stdio: 'inherit' });
180-
181181
proc.on('close', puts);
182182
}
183183

src/webpack-shell-plugin.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const defaultOptions = {
99

1010
function puts(error, stdout, stderr) {
1111
if (error) {
12-
console.log('Error: ', error, stderr);
12+
throw error;
1313
}
1414
}
1515

@@ -25,7 +25,6 @@ function serializeScript(script) {
2525
function handleScript(script) {
2626
const {command, args} = serializeScript(script);
2727
const proc = spawn(command, args, {stdio: 'inherit'});
28-
2928
proc.on('close', puts);
3029
}
3130

webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module.exports = {
1919
]
2020
},
2121
plugins: [
22-
new WebpackShellPlugin({onBuildStart:['echo "Webpack Start"'], onBuildEnd:['echo "Webpack End"']}),
22+
new WebpackShellPlugin({onBuildStart:['echo "Webpack Start"'], onBuildEnd:['node test.js']}),
2323
new webpack.HotModuleReplacementPlugin()
2424
]
2525
};

0 commit comments

Comments
 (0)