3

I'm using the following code on a linux web server

$error = exec('phantomjs table1.js', $op, $code);
echo $code; // prints 11 on screen

table1.js

var page = require('webpage').create();
var url = 'table1.php';
page.open(url, function (status) {
    page.render('ss/table1.png');
    phantom.exit();
});

table1.php

echo '<h1>This should be converted to an image</h1>';

I went through this link but that code isn't listed there. Any idea what this exit code stands for?

4

2 回答 2

2

代码 11 是“分段错误”:分段错误(也称为 segfault)是由程序在尝试在一块未分配给程序的内存中分配数据时引起的。它表示程序错误,并且通常(如果不总是)使程序崩溃。在您的情况下,段错误可能是由 phantomjs 引起的,这表明可能是旧版本或 beta 版本。

于 2013-04-24T11:36:11.063 回答
0

这是我发现的。

  • 您的 phantomjs 正在调用一些子进程。(我的假设是你在节点上执行这个)。
  • 现在,如果 table1.js 突然退出,那么返回代码将是二进制00001000的,主进程(根据假设的节点)也将退出,并带有相同的二进制错误代码。
  • 现在根据退出状态相关性,两个二进制文件都将转换为正常的符号信号,这使得两者都成为11.

因此您的错误代码为 11。

资料来源: Linux 中是否有任何标准的退出状态代码?

于 2013-04-24T11:54:43.497 回答