簡體   English   中英

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

[英]Grunt / PhoneGap : Warning: stdout maxBuffer exceeded

我隨機收到以下消息Warning: stdout maxBuffer exceeded當我使用我的grunt腳本啟動iOS模擬器時, Warning: stdout maxBuffer exceeded

知道什么可以觸發這個嗎?

這是我的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);
        });
    }
});

您可以使用選項來禁用maxBuffer:

shell: {
    yourCommand: {
        command: [
            'command to execute'
        ],
        options: {
            execOptions: {
                maxBuffer: Infinity
            }
        }
    }
}

當您生成子進程時,請嘗試在配置對象中碰撞maxBuffer:

execInstance = require('child_process').exec(command, {
    cwd : directoryPath,
    maxBuffer: 500 * 1024
}, function (err) {
    done(err);
});

根據文檔,默認的maxBuffer大小是200 * 1024( http://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM