使用exec执行命令后出现问题

时间:2016-06-08 20:13:41

标签: node.js bash express

我的节点js代码有问题。我正在尝试执行以下命令行:

job [command]:/ Synology/server_PRGdb/models/../drago2.sh -f files / 1465414445422 / CNL.fasta -hmm /Synology/server_PRGdb/models/../HMMs -o analyze / 1465414445422 / drago2 .txt>分析/ 1465414445422 / PutativeGenes.txt

输出文件(PutativeGenes.txt)是正确创建的,但它总是让我错误地进入条件错误,并且作为结果,它不会继续我的其余代码。为什么会这样?我附上了我的代码和错误消息。非常感谢!!

command = exec(job["command"], function(error, stdout, stderr){
    console.log(error);
    if(error){
        console.log(stderr);
    }else{
        drago2Model.updateID(job["id"], 1);

        if (job["email"] != "") { //user defined mail in the form
          smtpTransport.sendMail({ //sending mail
            from: "DRACMAGIC 2",
            to: job["email"],
            subject: "DRACMAGIC 2 analysis",
            text: "Your DRACMAGIC 2 analysis with ID " + job["id"] + " has finished.",
            attachments: [
                {   // utf-8 string as an attachment
                    path: appDir+"/analyses/"+job["id"]+"/PutativeGenes.txt"
                }
            ]
            }, function(err, response) {
              if (err) {
                console.log(err);
                console.log(response);
                console.log("Email (" + job["email"] + ") from DRACMAGIC 2 analysis " + job["id"] + " could not be sent.");
              }
            }
          );
        }
        isJobExecuted = 0;
    }

  });

错误:

 { [Error: Command failed: /bin/sh -c   /Synology/server_PRGdb/models/../drago2.sh -f files/1465414445422/CNL.fasta -hmm  /Synology/server_PRGdb/models/../HMMs -o analyses/1465414445422/drago2.txt >   analyses/1465414445422/PutativeGenes.txt
  66 sequences    71159 aas     1300 in coil
 ]
 killed: false,
 code: 1,
 signal: null,
 cmd: '/bin/sh -c /Synology/server_PRGdb/models/../drago2.sh -f    files/1465414445422/CNL.fasta -hmm /Synology/server_PRGdb/models/../HMMs -o analyses/1465414445422/drago2.txt > analyses/1465414445422/PutativeGenes.txt' }

0 个答案:

没有答案