exec Exit Code Meaning for 11

一世执手 提交于 2019-12-18 08:56:26

问题


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?


回答1:


Code 11 is a "segmentation fault": A segmentation fault (also segfault) is caused by a program when it tries to allocate data in a piece of memory that is not assigned to the program. It indicates a program error and usually (if not always) crashes the program. In your case, the segfault probably is caused by phantomjs, which indicates perhaps an old or beta version.




回答2:


This is what I found out.

  • Your phantomjs is calling some child process. (My assumption would be you are executing this on node).
  • Now, if table1.js exits abruptly, then return code will be binary 00001000 and the main process(node as per assumption) will also exit with the same binary error code.
  • Now as per exit status co-relation, both the binaries will be converted to normal sign signals which makes both to be 1 and 1.

Hence your error code of 11.

Source: Are there any standard exit status codes in Linux?



来源:https://stackoverflow.com/questions/16190926/exec-exit-code-meaning-for-11

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!