Permalink
Browse files

process, feat: support process.versions.

  • Loading branch information...
xicilion committed Sep 25, 2017
1 parent b3f6868 commit f97d881da0376348b8e853f9a6f7ca6fb463914a
Showing with 25 additions and 2 deletions.
  1. +14 −0 fibjs/include/ifs/process.h
  2. +6 −0 fibjs/src/process/process.cpp
  3. +1 −1 fibjs/src/sandbox/SandBox_repl.cpp
  4. +4 −1 idl/zh-cn/process.idl
@@ -29,6 +29,7 @@ class process_base : public EventEmitter_base {
static result_t get_argv(v8::Local<v8::Array>& retVal);
static result_t get_execArgv(v8::Local<v8::Array>& retVal);
static result_t get_version(exlib::string& retVal);
static result_t get_versions(v8::Local<v8::Object>& retVal);
static result_t get_execPath(exlib::string& retVal);
static result_t get_env(v8::Local<v8::Object>& retVal);
static result_t get_arch(exlib::string& retVal);
@@ -68,6 +69,7 @@ class process_base : public EventEmitter_base {
static void s_get_argv(v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& args);
static void s_get_execArgv(v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& args);
static void s_get_version(v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& args);
static void s_get_versions(v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& args);
static void s_get_execPath(v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& args);
static void s_get_env(v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& args);
static void s_get_arch(v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& args);
@@ -113,6 +115,7 @@ inline ClassInfo& process_base::class_info()
{ "argv", s_get_argv, block_set, true },
{ "execArgv", s_get_execArgv, block_set, true },
{ "version", s_get_version, block_set, true },
{ "versions", s_get_versions, block_set, true },
{ "execPath", s_get_execPath, block_set, true },
{ "env", s_get_env, block_set, true },
{ "arch", s_get_arch, block_set, true },
@@ -165,6 +168,17 @@ inline void process_base::s_get_version(v8::Local<v8::String> property, const v8
METHOD_RETURN();
}
inline void process_base::s_get_versions(v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& args)
{
v8::Local<v8::Object> vr;
PROPERTY_ENTER();
hr = get_versions(vr);
METHOD_RETURN();
}
inline void process_base::s_get_execPath(v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& args)
{
exlib::string vr;
@@ -10,6 +10,7 @@
#include "ifs/process.h"
#include "ifs/os.h"
#include "ifs/global.h"
#include "ifs/util.h"
#include "Fiber.h"
#include "File.h"
#include "BufferedStream.h"
@@ -108,6 +109,11 @@ result_t process_base::get_version(exlib::string& retVal)
return 0;
}
result_t process_base::get_versions(v8::Local<v8::Object>& retVal)
{
return util_base::buildInfo(retVal);
}
result_t process_base::umask(int32_t mask, int32_t& retVal)
{
retVal = _umask(mask);
@@ -80,7 +80,7 @@ bool repl_command(exlib::string& line, v8::Local<v8::Array> cmds)
if (cmd_word == ".info") {
v8::Local<v8::Object> o;
util_base::buildInfo(o);
process_base::get_versions(o);
console_base::dir(o);
return true;
}
View
@@ -13,9 +13,12 @@ module process : EventEmitter
/*! @brief 返回当前进程的特殊命令行参数,这些参数被 fibjs 用于设置运行环境 */
static readonly Array execArgv;
/*! @brief 返回fibjs版本字符串 */
/*! @brief 返回 fibjs 版本字符串 */
static readonly String version;
/*! @brief 返回 fibjs 及组件的版本信息 */
static readonly Object versions;
/*! @brief 查询当前运行执行文件完整路径 */
static readonly String execPath;

0 comments on commit f97d881

Please sign in to comment.