|
|
@ -29,17 +29,31 @@ |
|
|
|
#include <locale.h> |
|
|
|
#include <signal.h> |
|
|
|
#include <stdio.h> |
|
|
|
#if defined(_MSC_VER) |
|
|
|
#define snprintf _snprintf |
|
|
|
#endif |
|
|
|
#include <stdlib.h> |
|
|
|
#include <strings.h> |
|
|
|
#include <string.h> |
|
|
|
#if !defined(_MSC_VER) |
|
|
|
#include <strings.h> |
|
|
|
#else |
|
|
|
#define strcasecmp _stricmp |
|
|
|
#endif |
|
|
|
#include <limits.h> /* PATH_MAX */ |
|
|
|
#include <assert.h> |
|
|
|
#include <unistd.h> |
|
|
|
#if !defined(_MSC_VER) |
|
|
|
#include <unistd.h> /* setuid, getuid */ |
|
|
|
#else |
|
|
|
#include <direct.h> |
|
|
|
#define chdir _chdir |
|
|
|
#define getcwd _getcwd |
|
|
|
#include <process.h> |
|
|
|
#define getpid _getpid |
|
|
|
#endif |
|
|
|
#include <errno.h> |
|
|
|
#include <sys/types.h> |
|
|
|
#include <unistd.h> /* setuid, getuid */ |
|
|
|
|
|
|
|
#ifdef __MINGW32__ |
|
|
|
#if defined(__MINGW32__) || defined(_MSC_VER) |
|
|
|
# include <platform_win32.h> /* winapi_perror() */ |
|
|
|
# ifdef PTW32_STATIC_LIB |
|
|
|
extern "C" { |
|
|
@ -69,13 +83,15 @@ extern "C" { |
|
|
|
# include <node_stat_watcher.h> |
|
|
|
# include <node_timer.h> |
|
|
|
#endif |
|
|
|
#if !defined(_MSC_VER) |
|
|
|
#include <node_child_process.h> |
|
|
|
#endif |
|
|
|
#include <node_constants.h> |
|
|
|
#include <node_stdio.h> |
|
|
|
#include <node_javascript.h> |
|
|
|
#include <node_version.h> |
|
|
|
#include <node_string.h> |
|
|
|
#ifdef HAVE_OPENSSL |
|
|
|
#if HAVE_OPENSSL |
|
|
|
# include <node_crypto.h> |
|
|
|
#endif |
|
|
|
#include <node_script.h> |
|
|
@ -87,7 +103,7 @@ using namespace v8; |
|
|
|
# ifdef __APPLE__ |
|
|
|
# include <crt_externs.h> |
|
|
|
# define environ (*_NSGetEnviron()) |
|
|
|
# else |
|
|
|
# elif !defined(_MSC_VER) |
|
|
|
extern char **environ; |
|
|
|
# endif |
|
|
|
|
|
|
@ -2086,7 +2102,7 @@ Handle<Object> SetupProcessObject(int argc, char *argv[]) { |
|
|
|
versions->Set(String::NewSymbol("ares"), String::New(ARES_VERSION_STR)); |
|
|
|
snprintf(buf, 20, "%d.%d", UV_VERSION_MAJOR, UV_VERSION_MINOR); |
|
|
|
versions->Set(String::NewSymbol("uv"), String::New(buf)); |
|
|
|
#ifdef HAVE_OPENSSL |
|
|
|
#if HAVE_OPENSSL |
|
|
|
// Stupid code to slice out the version string.
|
|
|
|
int c, l = strlen(OPENSSL_VERSION_TEXT); |
|
|
|
for (i = 0; i < l; i++) { |
|
|
@ -2154,13 +2170,14 @@ Handle<Object> SetupProcessObject(int argc, char *argv[]) { |
|
|
|
} |
|
|
|
|
|
|
|
size_t size = 2*PATH_MAX; |
|
|
|
char execPath[size]; |
|
|
|
char* execPath = new char[size]; |
|
|
|
if (uv_exepath(execPath, &size) != 0) { |
|
|
|
// as a last ditch effort, fallback on argv[0] ?
|
|
|
|
process->Set(String::NewSymbol("execPath"), String::New(argv[0])); |
|
|
|
} else { |
|
|
|
process->Set(String::NewSymbol("execPath"), String::New(execPath, size)); |
|
|
|
} |
|
|
|
delete [] execPath; |
|
|
|
|
|
|
|
|
|
|
|
// define various internal methods
|
|
|
@ -2531,7 +2548,7 @@ void EmitExit(v8::Handle<v8::Object> process) { |
|
|
|
|
|
|
|
int Start(int argc, char *argv[]) { |
|
|
|
|
|
|
|
#if defined __MINGW32__ && defined PTW32_STATIC_LIB |
|
|
|
#if (defined(__MINGW32__) || defined(_MSC_VER)) && defined(PTW32_STATIC_LIB) |
|
|
|
pthread_win32_process_attach_np(); |
|
|
|
#endif |
|
|
|
|
|
|
@ -2568,7 +2585,7 @@ int Start(int argc, char *argv[]) { |
|
|
|
V8::Dispose(); |
|
|
|
#endif // NDEBUG
|
|
|
|
|
|
|
|
#if defined __MINGW32__ && defined PTW32_STATIC_LIB |
|
|
|
#if (defined(__MINGW32__) || defined(_MSC_VER)) && defined(PTW32_STATIC_LIB) |
|
|
|
pthread_win32_process_detach_np(); |
|
|
|
#endif |
|
|
|
|
|
|
|