Skip to content

Commit 5c085ae

Browse files
committed
Refactor use of process
1 parent f65464e commit 5c085ae

3 files changed

Lines changed: 14 additions & 12 deletions

File tree

lib/node_modules/@stdlib/crypto/arc4/bin/cli

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ var resolve = require( 'path' ).resolve;
2626
var readFileSync = require( '@stdlib/fs/read-file' ).sync;
2727
var CLI = require( '@stdlib/tools/cli' );
2828
var stdin = require( '@stdlib/process/read-stdin' );
29+
var stdinStream = require( '@stdlib/streams/node/stdin' );
2930
var RE_EOL = require( '@stdlib/regexp/eol' );
3031
var arc4 = require( './../lib' );
3132

@@ -66,7 +67,7 @@ function main() {
6667
cipher = arc4( flags.key );
6768

6869
// Check if we are receiving data from `stdin`...
69-
if ( !process.stdin.isTTY ) {
70+
if ( !stdinStream.isTTY ) {
7071
return stdin( onData );
7172
}
7273
console.log( cipher( args[ 0 ] ) ); // eslint-disable-line no-console

lib/node_modules/@stdlib/crypto/arc4/test/fixtures/stdin_error.js.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616
* limitations under the License.
1717
*/
1818

19+
var proc = require( 'process' );
1920
var resolve = require( 'path' ).resolve;
2021
var proxyquire = require( 'proxyquire' );
2122

2223
var fpath = resolve( __dirname, '..', 'bin', 'cli' );
2324

24-
process.stdin.isTTY = false;
25-
26-
process.argv[ 2 ] = '--key=pwd12';
25+
proc.stdin.isTTY = false;
26+
proc.argv[ 2 ] = '--key=pwd12';
2727

2828
proxyquire( fpath, {
2929
'@stdlib/process/read-stdin': stdin

lib/node_modules/@stdlib/crypto/arc4/test/test.cli.js

Lines changed: 9 additions & 8 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 replace = require( '@stdlib/string/replace' );
2930
var readFileSync = require( '@stdlib/fs/read-file' ).sync;
3031

@@ -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 encrypts and prints a text using an (alleged) RC4 cypher', opts, function test( t ) {
145146
var cmd = [
146-
process.execPath,
147+
EXEC_PATH,
147148
'-e',
148149
'"process.stdin.isTTY = true; process.argv[ 2 ] = \'beep boop\'; process.argv[ 3 ] = \'--key=pwd12\'; require( \''+fpath+'\' );"'
149150
];
@@ -165,11 +166,11 @@ tape( 'the command-line interface supports use as a standard stream', opts, func
165166
var cmd = [
166167
'printf "beep\nboop\nboop"',
167168
'|',
168-
process.execPath,
169+
EXEC_PATH,
169170
fpath,
170171
'--key pwd12',
171172
'|',
172-
process.execPath,
173+
EXEC_PATH,
173174
fpath,
174175
'--key pwd12'
175176
];
@@ -200,7 +201,7 @@ tape( 'when used as a standard stream, if an error is encountered when reading f
200201
script = replace( script, '\'', '"' );
201202

202203
cmd = [
203-
process.execPath,
204+
EXEC_PATH,
204205
'-e',
205206
'\''+script+'\''
206207
];

0 commit comments

Comments
 (0)