Grunt/PhoneGap:警告:超出了stdout maxBuffer

Mat*_*ler 5 macos ios cordova gruntjs

Warning: stdout maxBuffer exceeded当我使用我的grunt脚本启动iOS模拟器时,我会得到以下消息.

知道什么可以触发这个吗?

这是我的Gruntfile的一部分:

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);
        });
    }
});
Run Code Online (Sandbox Code Playgroud)

ers*_*ril 23

您可以使用选项来禁用maxBuffer:

shell: {
    yourCommand: {
        command: [
            'command to execute'
        ],
        options: {
            execOptions: {
                maxBuffer: Infinity
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

  • 在此日期对当前版本的我不起作用.这样的行为完全忽略了maxBuffer选项. (3认同)