Ios Grunt/PhoneGap:警告:超出标准输出maxBuffer
当我使用grunt脚本启动iOS模拟器时,我随机收到以下消息Ios Grunt/PhoneGap:警告:超出标准输出maxBuffer,ios,macos,cordova,gruntjs,Ios,Macos,Cordova,Gruntjs,当我使用grunt脚本启动iOS模拟器时,我随机收到以下消息警告:超过stdout maxBuffer 知道是什么触发了这一切吗 以下是我的GrunFile中出现的部分: grunt.registerTask('emulator', 'Launch an emulator', function (platform, targetId) { if (arguments.length === 0 || !platform) { grunt.fail.fatal('No pla
警告:超过stdout maxBuffer
知道是什么触发了这一切吗
以下是我的GrunFile中出现的部分:
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);
});
}
});
生成子进程时,请尝试在配置对象中缓冲maxBuffer:
execInstance = require('child_process').exec(command, {
cwd : directoryPath,
maxBuffer: 500 * 1024
}, function (err) {
done(err);
});
根据文档,默认的maxBuffer大小为200*1024()您可以使用一个选项禁用maxBuffer:
shell: {
yourCommand: {
command: [
'command to execute'
],
options: {
execOptions: {
maxBuffer: Infinity
}
}
}
}
当前版本不适用于我。就像完全忽略了maxBuffer选项一样。