Skip to content

Commit fdb5760

Browse files
committed
Refactor use of process
1 parent c412b06 commit fdb5760

File tree

14 files changed

+78
-52
lines changed

14 files changed

+78
-52
lines changed

lib/node_modules/@stdlib/os/arch/lib/main.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818

1919
'use strict';
2020

21+
// MODULES //
22+
23+
var proc = require( 'process' );
24+
25+
2126
// MAIN //
2227

2328
/**
@@ -26,7 +31,7 @@
2631
* @constant
2732
* @type {string}
2833
*/
29-
var ARCH = process.arch;
34+
var ARCH = proc.arch;
3035

3136

3237
// EXPORTS //

lib/node_modules/@stdlib/os/arch/test/test.cli.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@
2020

2121
// MODULES //
2222

23+
var proc = require( 'process' );
2324
var resolve = require( 'path' ).resolve;
2425
var exec = require( 'child_process' ).exec;
2526
var tape = require( 'tape' );
2627
var IS_BROWSER = require( '@stdlib/assert/is-browser' );
2728
var IS_WINDOWS = require( '@stdlib/assert/is-windows' );
29+
var EXEC_PATH = require( '@stdlib/process/exec-path' );
2830
var readFileSync = require( '@stdlib/fs/read-file' ).sync;
2931

3032

@@ -56,7 +58,7 @@ tape( 'when invoked with a `--help` flag, the command-line interface prints the
5658
'encoding': 'utf8'
5759
});
5860
cmd = [
59-
process.execPath,
61+
EXEC_PATH,
6062
fpath,
6163
'--help'
6264
];
@@ -82,7 +84,7 @@ tape( 'when invoked with a `-h` flag, the command-line interface prints the help
8284
'encoding': 'utf8'
8385
});
8486
cmd = [
85-
process.execPath,
87+
EXEC_PATH,
8688
fpath,
8789
'-h'
8890
];
@@ -102,7 +104,7 @@ tape( 'when invoked with a `-h` flag, the command-line interface prints the help
102104

103105
tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) {
104106
var cmd = [
105-
process.execPath,
107+
EXEC_PATH,
106108
fpath,
107109
'--version'
108110
];
@@ -122,7 +124,7 @@ tape( 'when invoked with a `--version` flag, the command-line interface prints t
122124

123125
tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) {
124126
var cmd = [
125-
process.execPath,
127+
EXEC_PATH,
126128
fpath,
127129
'-V'
128130
];
@@ -142,7 +144,7 @@ tape( 'when invoked with a `-V` flag, the command-line interface prints the vers
142144

143145
tape( 'the command-line interface prints `process.arch` to `stdout` indicating the operating system CPU architecture', opts, function test( t ) {
144146
var cmd = [
145-
process.execPath,
147+
EXEC_PATH,
146148
fpath
147149
];
148150

@@ -154,7 +156,7 @@ tape( 'the command-line interface prints `process.arch` to `stdout` indicating t
154156
t.fail( error.message );
155157
} else {
156158
str = stdout.toString();
157-
t.strictEqual( str === process.arch+'\n', true, 'prints the architecture to `stdout`' );
159+
t.strictEqual( str === proc.arch+'\n', true, 'prints the architecture to `stdout`' );
158160
t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' );
159161
}
160162
t.end();

lib/node_modules/@stdlib/os/arch/test/test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
// MODULES //
2222

23+
var proc = require( 'process' );
2324
var tape = require( 'tape' );
2425
var ARCH = require( './../lib' );
2526

@@ -33,6 +34,6 @@ tape( 'main export is a string', function test( t ) {
3334
});
3435

3536
tape( 'should alias `process.arch`', function test( t ) {
36-
t.equal( ARCH, process.arch, 'is alias' );
37+
t.equal( ARCH, proc.arch, 'is alias' );
3738
t.end();
3839
});

lib/node_modules/@stdlib/os/byte-order/test/test.cli.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ var exec = require( 'child_process' ).exec;
2525
var tape = require( 'tape' );
2626
var IS_BROWSER = require( '@stdlib/assert/is-browser' );
2727
var IS_WINDOWS = require( '@stdlib/assert/is-windows' );
28+
var EXEC_PATH = require( '@stdlib/process/exec-path' );
2829
var readFileSync = require( '@stdlib/fs/read-file' ).sync;
2930

3031

@@ -56,7 +57,7 @@ tape( 'when invoked with a `--help` flag, the command-line interface prints the
5657
'encoding': 'utf8'
5758
});
5859
cmd = [
59-
process.execPath,
60+
EXEC_PATH,
6061
fpath,
6162
'--help'
6263
];
@@ -82,7 +83,7 @@ tape( 'when invoked with a `-h` flag, the command-line interface prints the help
8283
'encoding': 'utf8'
8384
});
8485
cmd = [
85-
process.execPath,
86+
EXEC_PATH,
8687
fpath,
8788
'-h'
8889
];
@@ -102,7 +103,7 @@ tape( 'when invoked with a `-h` flag, the command-line interface prints the help
102103

103104
tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) {
104105
var cmd = [
105-
process.execPath,
106+
EXEC_PATH,
106107
fpath,
107108
'--version'
108109
];
@@ -122,7 +123,7 @@ tape( 'when invoked with a `--version` flag, the command-line interface prints t
122123

123124
tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) {
124125
var cmd = [
125-
process.execPath,
126+
EXEC_PATH,
126127
fpath,
127128
'-V'
128129
];
@@ -140,9 +141,9 @@ tape( 'when invoked with a `-V` flag, the command-line interface prints the vers
140141
}
141142
});
142143

143-
tape( 'the command-line interface prints `process.platform` to `stdout` indicating the platform byte order', opts, function test( t ) {
144+
tape( 'the command-line interface prints to `stdout` indicating the platform byte order', opts, function test( t ) {
144145
var cmd = [
145-
process.execPath,
146+
EXEC_PATH,
146147
fpath
147148
];
148149

@@ -154,7 +155,7 @@ tape( 'the command-line interface prints `process.platform` to `stdout` indicati
154155
t.fail( error.message );
155156
} else {
156157
str = stdout.toString();
157-
t.strictEqual( str === 'little-endian\n' || str === 'big-endian\n', true, 'prints the platform to `stdout`' );
158+
t.strictEqual( str === 'little-endian\n' || str === 'big-endian\n', true, 'prints to `stdout`' );
158159
t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' );
159160
}
160161
t.end();

lib/node_modules/@stdlib/os/configdir/test/test.cli.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var isAbsolutePath = require( '@stdlib/assert/is-absolute-path' );
2727
var IS_BROWSER = require( '@stdlib/assert/is-browser' );
2828
var IS_WINDOWS = require( '@stdlib/assert/is-windows' );
2929
var readFileSync = require( '@stdlib/fs/read-file' ).sync;
30+
var EXEC_PATH = require( '@stdlib/process/exec-path' );
3031

3132

3233
// VARIABLES //
@@ -57,7 +58,7 @@ tape( 'when invoked with a `--help` flag, the command-line interface prints the
5758
'encoding': 'utf8'
5859
});
5960
cmd = [
60-
process.execPath,
61+
EXEC_PATH,
6162
fpath,
6263
'--help'
6364
];
@@ -83,7 +84,7 @@ tape( 'when invoked with a `-h` flag, the command-line interface prints the help
8384
'encoding': 'utf8'
8485
});
8586
cmd = [
86-
process.execPath,
87+
EXEC_PATH,
8788
fpath,
8889
'-h'
8990
];
@@ -103,7 +104,7 @@ tape( 'when invoked with a `-h` flag, the command-line interface prints the help
103104

104105
tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) {
105106
var cmd = [
106-
process.execPath,
107+
EXEC_PATH,
107108
fpath,
108109
'--version'
109110
];
@@ -123,7 +124,7 @@ tape( 'when invoked with a `--version` flag, the command-line interface prints t
123124

124125
tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) {
125126
var cmd = [
126-
process.execPath,
127+
EXEC_PATH,
127128
fpath,
128129
'-V'
129130
];
@@ -143,7 +144,7 @@ tape( 'when invoked with a `-V` flag, the command-line interface prints the vers
143144

144145
tape( 'the command-line interface prints the directory for user-specific configuration files', opts, function test( t ) {
145146
var cmd = [
146-
process.execPath,
147+
EXEC_PATH,
147148
fpath
148149
];
149150

lib/node_modules/@stdlib/os/float-word-order/test/test.cli.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ var tape = require( 'tape' );
2626
var IS_BROWSER = require( '@stdlib/assert/is-browser' );
2727
var IS_WINDOWS = require( '@stdlib/assert/is-windows' );
2828
var readFileSync = require( '@stdlib/fs/read-file' ).sync;
29+
var EXEC_PATH = require( '@stdlib/process/exec-path' );
2930

3031

3132
// VARIABLES //
@@ -56,7 +57,7 @@ tape( 'when invoked with a `--help` flag, the command-line interface prints the
5657
'encoding': 'utf8'
5758
});
5859
cmd = [
59-
process.execPath,
60+
EXEC_PATH,
6061
fpath,
6162
'--help'
6263
];
@@ -82,7 +83,7 @@ tape( 'when invoked with a `-h` flag, the command-line interface prints the help
8283
'encoding': 'utf8'
8384
});
8485
cmd = [
85-
process.execPath,
86+
EXEC_PATH,
8687
fpath,
8788
'-h'
8889
];
@@ -102,7 +103,7 @@ tape( 'when invoked with a `-h` flag, the command-line interface prints the help
102103

103104
tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) {
104105
var cmd = [
105-
process.execPath,
106+
EXEC_PATH,
106107
fpath,
107108
'--version'
108109
];
@@ -122,7 +123,7 @@ tape( 'when invoked with a `--version` flag, the command-line interface prints t
122123

123124
tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) {
124125
var cmd = [
125-
process.execPath,
126+
EXEC_PATH,
126127
fpath,
127128
'-V'
128129
];
@@ -140,9 +141,9 @@ tape( 'when invoked with a `-V` flag, the command-line interface prints the vers
140141
}
141142
});
142143

143-
tape( 'the command-line interface prints `process.platform` to `stdout` indicating the platform float word order', opts, function test( t ) {
144+
tape( 'the command-line interface prints to `stdout` indicating the platform float word order', opts, function test( t ) {
144145
var cmd = [
145-
process.execPath,
146+
EXEC_PATH,
146147
fpath
147148
];
148149

@@ -154,7 +155,7 @@ tape( 'the command-line interface prints `process.platform` to `stdout` indicati
154155
t.fail( error.message );
155156
} else {
156157
str = stdout.toString();
157-
t.strictEqual( str === 'little-endian\n' || str === 'big-endian\n', true, 'prints the platform to `stdout`' );
158+
t.strictEqual( str === 'little-endian\n' || str === 'big-endian\n', true, 'prints to `stdout`' );
158159
t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' );
159160
}
160161
t.end();

lib/node_modules/@stdlib/os/homedir/test/test.cli.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ var tape = require( 'tape' );
2626
var isAbsolutePath = require( '@stdlib/assert/is-absolute-path' );
2727
var IS_BROWSER = require( '@stdlib/assert/is-browser' );
2828
var IS_WINDOWS = require( '@stdlib/assert/is-windows' );
29+
var EXEC_PATH = require( '@stdlib/process/exec-path' );
2930
var readFileSync = require( '@stdlib/fs/read-file' ).sync;
3031

3132

@@ -57,7 +58,7 @@ tape( 'when invoked with a `--help` flag, the command-line interface prints the
5758
'encoding': 'utf8'
5859
});
5960
cmd = [
60-
process.execPath,
61+
EXEC_PATH,
6162
fpath,
6263
'--help'
6364
];
@@ -83,7 +84,7 @@ tape( 'when invoked with a `-h` flag, the command-line interface prints the help
8384
'encoding': 'utf8'
8485
});
8586
cmd = [
86-
process.execPath,
87+
EXEC_PATH,
8788
fpath,
8889
'-h'
8990
];
@@ -103,7 +104,7 @@ tape( 'when invoked with a `-h` flag, the command-line interface prints the help
103104

104105
tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) {
105106
var cmd = [
106-
process.execPath,
107+
EXEC_PATH,
107108
fpath,
108109
'--version'
109110
];
@@ -123,7 +124,7 @@ tape( 'when invoked with a `--version` flag, the command-line interface prints t
123124

124125
tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) {
125126
var cmd = [
126-
process.execPath,
127+
EXEC_PATH,
127128
fpath,
128129
'-V'
129130
];
@@ -143,7 +144,7 @@ tape( 'when invoked with a `-V` flag, the command-line interface prints the vers
143144

144145
tape( 'the command-line interface prints the current user\'s home directory', opts, function test( t ) {
145146
var cmd = [
146-
process.execPath,
147+
EXEC_PATH,
147148
fpath
148149
];
149150

lib/node_modules/@stdlib/os/num-cpus/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,21 @@ var n = NUM_CPUS;
5858

5959
## Examples
6060

61+
<!-- run-disable -->
62+
6163
<!-- eslint-disable no-process-exit -->
6264

6365
<!-- eslint no-undef: "error" -->
6466

6567
```javascript
68+
var proc = require( 'process' );
6669
var cluster = require( 'cluster' );
6770
var NUM_CPUS = require( '@stdlib/os/num-cpus' );
6871

6972
var i;
7073

7174
function onTimeout() {
72-
process.exit( 0 );
75+
proc.exit( 0 );
7376
}
7477

7578
if ( cluster.isMaster ) {

lib/node_modules/@stdlib/os/num-cpus/examples/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818

1919
'use strict';
2020

21+
var proc = require( 'process' );
2122
var cluster = require( 'cluster' );
2223
var NUM_CPUS = require( './../lib' );
2324

2425
var i;
2526

2627
function onTimeout() {
27-
process.exit( 0 ); // eslint-disable-line no-process-exit
28+
proc.exit( 0 );
2829
}
2930

3031
if ( cluster.isMaster ) {

0 commit comments

Comments
 (0)