CNode

按照node入门做到一个demo有点儿不对,麻烦看下.

Ffirhome发布于12 年前最后回复12 年前1 回复4101 浏览0 收藏

exec("dir", { timeout: 10000, maxBuffer: 20000 * 1024 }, function(error, stdout, stderr) {

});

为何此处 {

timeout: 10000,

maxBuffer: 20000 * 1024

}

无效?

查看回复

回复 (1)

L
loginyourheart#1·12 年前

RE:请给出具体例子地址

timeout:进程超时时间

maxBuffer:stdout或stderr可增长的最大值

var exec = require('child_process').exec, child;

child = exec(

'dir',

{ timeout : 10000, cwd : '../' },

function (error, stdout, stderr) { console.log('stdout: \n' + stdout); console.log('stderr: \n' + stderr); if (error !== null) { console.log('exec error: ' + error); }

});

cwd设置成功,判断里面的参数应该是有效的

参与回复
登录后即可参与回复。登录