我正在按照http://nodebeginner.org上的步骤操作并使用 C9 作为我的 IDE。当我require
child_process 时出现此错误:
代码:
var exec = require("child_process").exec;
function start(response) {
console.log("Request handler 'start' was called.");
exec("ls -lah", function (error, stdout, stderr) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.write(stdout);
response.end();
});
}
function upload(response) {
console.log("Request handler 'upload' was called.");
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello Upload");
response.end();
}
exports.start = start;
exports.upload = upload;
错误:
Request handler 'start' was called.
child_process.js:243
var fds = this._internal.spawn(path,
^
Error: Spawn disabled for securtity reasons
at ChildProcess.spawn (child_process.js:243:28)
at child_process.js:31:15
at child_process.js:77:15
at child_process.js:38:27
at Object.start (/mnt/ws/users/mithun-daa/104441/requestHandler.js:6:3)
at route (/mnt/ws/users/mithun-daa/104441/router.js:4:20)
at Server.onRequest (/mnt/ws/users/mithun-daa/104441/server.js:9:5)
at Server.emit (events.js:67:17)
at HTTPParser.onIncoming (http.js:1134:12)
at HTTPParser.onHeadersComplete (http.js:108:31)
任何帮助,将不胜感激。