Skip to content

Commit 1554c9c

Browse files
author
Michel Hofmann
committed
fix: bound this to puts()
1 parent 4360ba7 commit 1554c9c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ var WebpackShellPlugin = function () {
8989

9090
createClass(WebpackShellPlugin, [{
9191
key: 'puts',
92-
value: function puts(error, stdout, stderr) {
92+
value: function puts(error) {
9393
if (error && !this.options.swallowError) {
9494
throw error;
9595
}
@@ -120,14 +120,14 @@ var WebpackShellPlugin = function () {
120120
key: 'handleScript',
121121
value: function handleScript(script) {
122122
if (os.platform() === 'win32' || this.options.safe) {
123-
this.spreadStdoutAndStdErr(exec(script, this.puts));
123+
this.spreadStdoutAndStdErr(exec(script, this.puts.bind(this)));
124124
} else {
125125
var _serializeScript = this.serializeScript(script),
126126
command = _serializeScript.command,
127127
args = _serializeScript.args;
128128

129129
var proc = spawn(command, args, { stdio: 'inherit' });
130-
proc.on('close', this.puts);
130+
proc.on('close', this.puts.bind(this));
131131
}
132132
}
133133
}, {

src/webpack-shell-plugin.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default class WebpackShellPlugin {
1717
this.options = this.validateInput(this.mergeOptions(options, defaultOptions));
1818
}
1919

20-
puts(error, stdout, stderr) {
20+
puts(error) {
2121
if (error && !this.options.swallowError) {
2222
throw error;
2323
}
@@ -39,11 +39,11 @@ export default class WebpackShellPlugin {
3939

4040
handleScript(script) {
4141
if (os.platform() === 'win32' || this.options.safe) {
42-
this.spreadStdoutAndStdErr(exec(script, this.puts));
42+
this.spreadStdoutAndStdErr(exec(script, this.puts.bind(this)));
4343
} else {
4444
const {command, args} = this.serializeScript(script);
4545
const proc = spawn(command, args, {stdio: 'inherit'});
46-
proc.on('close', this.puts);
46+
proc.on('close', this.puts.bind(this));
4747
}
4848
}
4949

0 commit comments

Comments
 (0)