Skip to content

Commit f3ad635

Browse files
committed
Downcase process.ARGV/ENV to process.argv/env
1 parent 8f52142 commit f3ad635

File tree

3 files changed

+21
-18
lines changed

3 files changed

+21
-18
lines changed

doc/api.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ execution.
4848

4949
=== Global Objects
5050

51-
+GLOBAL+ ::
51+
+global+ ::
5252
The global namespace object.
5353

5454
+process+ ::
@@ -100,10 +100,10 @@ more information.
100100
signal names such as SIGINT, SIGUSR1, etc.
101101
|=========================================================
102102

103-
+process.ARGV+ ::
103+
+process.argv+ ::
104104
An array containing the command line arguments.
105105

106-
+process.ENV+ ::
106+
+process.env+ ::
107107
An object containing the user environment. See environ(7).
108108

109109
+process.pid+ ::
@@ -565,7 +565,7 @@ Node provides a tridirectional +popen(3)+ facility through the class
565565
+"error"+ callbacks will no longer be made.
566566
|=========================================================
567567

568-
+process.createChildProcess(command, args=[], env=ENV)+::
568+
+process.createChildProcess(command, args=[], env=process.env)+::
569569
Launches a new process with the given +command+, command line arguments, and
570570
environmental variables. For example:
571571
+

src/node.cc

+5-2
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@ static void Load(int argc, char *argv[]) {
914914
#define str(s) #s
915915
process->Set(String::NewSymbol("platform"), String::New(xstr(PLATFORM)));
916916

917-
// process.ARGV
917+
// process.argv
918918
int i, j;
919919
Local<Array> arguments = Array::New(argc - dash_dash_index + 1);
920920
arguments->Set(Integer::New(0), String::New(argv[0]));
@@ -924,8 +924,9 @@ static void Load(int argc, char *argv[]) {
924924
}
925925
// assign it
926926
process->Set(String::NewSymbol("ARGV"), arguments);
927+
process->Set(String::NewSymbol("argv"), arguments);
927928

928-
// create process.ENV
929+
// create process.env
929930
Local<Object> env = Object::New();
930931
for (i = 0; environ[i]; i++) {
931932
// skip entries without a '=' character
@@ -941,6 +942,8 @@ static void Load(int argc, char *argv[]) {
941942
}
942943
// assign process.ENV
943944
process->Set(String::NewSymbol("ENV"), env);
945+
process->Set(String::NewSymbol("env"), env);
946+
944947
process->Set(String::NewSymbol("pid"), Integer::New(getpid()));
945948

946949
// define various internal methods

src/node.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ process.inherits = function (ctor, superCtor) {
8686
process.createChildProcess = function (file, args, env) {
8787
var child = new process.ChildProcess();
8888
args = args || [];
89-
env = env || process.ENV;
89+
env = env || process.env;
9090
var envPairs = [];
9191
for (var key in env) {
9292
if (env.hasOwnProperty(key)) {
@@ -493,7 +493,7 @@ GLOBAL.clearInterval = GLOBAL.clearTimeout;
493493
// Modules
494494

495495
var debugLevel = 0;
496-
if ("NODE_DEBUG" in process.ENV) debugLevel = 1;
496+
if ("NODE_DEBUG" in process.env) debugLevel = 1;
497497

498498
function debug (x) {
499499
if (debugLevel > 0) {
@@ -744,12 +744,12 @@ var path = pathModule.exports;
744744
process.paths = [ path.join(process.installPrefix, "lib/node/libraries")
745745
];
746746

747-
if (process.ENV["HOME"]) {
748-
process.paths.unshift(path.join(process.ENV["HOME"], ".node_libraries"));
747+
if (process.env["HOME"]) {
748+
process.paths.unshift(path.join(process.env["HOME"], ".node_libraries"));
749749
}
750750

751-
if (process.ENV["NODE_PATH"]) {
752-
process.paths = process.ENV["NODE_PATH"].split(":").concat(process.paths);
751+
if (process.env["NODE_PATH"]) {
752+
process.paths = process.env["NODE_PATH"].split(":").concat(process.paths);
753753
}
754754

755755

@@ -968,19 +968,19 @@ process.exit = function (code) {
968968

969969
var cwd = process.cwd();
970970

971-
// Make process.ARGV[0] and process.ARGV[1] into full paths.
972-
if (process.ARGV[0].indexOf('/') > 0) {
973-
process.ARGV[0] = path.join(cwd, process.ARGV[0]);
971+
// Make process.argv[0] and process.argv[1] into full paths.
972+
if (process.argv[0].indexOf('/') > 0) {
973+
process.argv[0] = path.join(cwd, process.argv[0]);
974974
}
975975

976-
if (process.ARGV[1].charAt(0) != "/" && !(/^http:\/\//).exec(process.ARGV[1])) {
977-
process.ARGV[1] = path.join(cwd, process.ARGV[1]);
976+
if (process.argv[1].charAt(0) != "/" && !(/^http:\/\//).exec(process.argv[1])) {
977+
process.argv[1] = path.join(cwd, process.argv[1]);
978978
}
979979

980980
// Load the main module--the command line argument.
981981
process.mainModule = createModule(".");
982982
var loadPromise = new events.Promise();
983-
process.mainModule.load(process.ARGV[1], loadPromise);
983+
process.mainModule.load(process.argv[1], loadPromise);
984984

985985
// All our arguments are loaded. We've evaluated all of the scripts. We
986986
// might even have created TCP servers. Now we enter the main eventloop. If

0 commit comments

Comments
 (0)