Ошибка C9: Spawn отключен по соображениям безопасности - PullRequest
2 голосов
/ 16 ноября 2011

Я следую инструкциям на 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)

Любая помощь будет оценена.

1 Ответ

2 голосов
/ 16 ноября 2011

C9 не позволяет вам использовать дочерние процессы по соображениям безопасности. Вы не сможете использовать там дочерние процессы, попробуйте их локально.

...