正常C++ execl工作正常(编译g++ ok.cc -o ok.elf)
#include <unistd.h>
int main(){
execl("/usr/bin/python", "/usr/bin/python", nullptr);
}
Run Code Online (Sandbox Code Playgroud)
但崩溃时,作为node.js C++插件工作
#include <node.h>
#include <unistd.h>
namespace bug{
void wtf(const v8::FunctionCallbackInfo<v8::Value>& args){
execl("/usr/bin/python", "/usr/bin/python", nullptr);
}
void init(v8::Local<v8::Object> exports){
NODE_SET_METHOD(exports, "wtf", bug::wtf);
}
NODE_MODULE(NODE_GYP_MODULE_NAME, init)
}
Run Code Online (Sandbox Code Playgroud)
node.js v8.9.1
node-gyp v3.6.2
gcc版本6.3.0 20170406 (Ubuntu 6.3.0-12ubuntu2)