Quite randomly I get the following message Warning: stdout maxBuffer exceeded
when I use my grunt script to launch the iOS simulator.
Any idea what could trigger this ?
Here is the part of my Gruntfile where it occurs :
grunt.registerTask('emulator', 'Launch an emulator', function (platform, targetId) {
if (arguments.length === 0 || !platform) {
grunt.fail.fatal('No platform was specified');
} else {
grunt.log.writeln('We launch the emulator for ' + platform);
if (targetId) {
grunt.log.writeln('Specified targetId: ' + targetId);
}
var fs = require('fs'), execInstance, directoryPath, command, done = this.async();
if (platform === 'ios') {
directoryPath = phoneGapBuildPath + '/platforms/' + platform.toLowerCase() + '/cordova/';
command = './run';
} else {
directoryPath = phoneGapBuildPath + '/platforms/' + platform.toLowerCase() + '/cordova/';
command = 'node run ' + (targetId ? '--target=' + targetId : '--debug');
}
if (!fs.existsSync(directoryPath)) {
grunt.fail.fatal('You need to launch the compile phase');
return;
}
grunt.log.writeln('We run the following command: ' + command);
execInstance = require('child_process').exec(command, {
cwd : directoryPath
}, function (err) {
done(err);
});
execInstance.stdout.on('data', function (data) {
grunt.log.writeln(data);
});
execInstance.stderr.on('data', function (data) {
grunt.log.error(data);
});
}
});
You can use an option to disable maxBuffer :
shell: {
yourCommand: {
command: [
'command to execute'
],
options: {
execOptions: {
maxBuffer: Infinity
}
}
}
}
When you spawn the child process, try bumping maxBuffer in your config object:
execInstance = require('child_process').exec(command, {
cwd : directoryPath,
maxBuffer: 500 * 1024
}, function (err) {
done(err);
});
According to the docs, the default maxBuffer size is 200 * 1024 (http://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With