Commit 051d482 1 parent e67542a commit 051d482 Copy full SHA for 051d482
File tree 3 files changed +22
-15
lines changed
3 files changed +22
-15
lines changed Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
- module . exports = { createRepl : createRepl } ;
4
-
5
3
const Interface = require ( 'readline' ) . Interface ;
6
4
const REPL = require ( 'repl' ) ;
7
5
const path = require ( 'path' ) ;
8
6
7
+ module . exports = Object . create ( REPL ) ;
8
+ module . exports . createInternalRepl = createRepl ;
9
+
9
10
// XXX(chrisdickinson): The 15ms debounce value is somewhat arbitrary.
10
11
// The debounce is to guard against code pasted into the REPL.
11
12
const kDebounceHistoryMS = 15 ;
12
13
13
- try {
14
- // hack for require.resolve("./relative") to work properly.
15
- module . filename = path . resolve ( 'repl' ) ;
16
- } catch ( e ) {
17
- // path.resolve('repl') fails when the current working directory has been
18
- // deleted. Fall back to the directory name of the (absolute) executable
19
- // path. It's not really correct but what are the alternatives?
20
- const dirname = path . dirname ( process . execPath ) ;
21
- module . filename = path . resolve ( dirname , 'repl' ) ;
14
+ // XXX(chrisdickinson): hack to make sure that the internal debugger
15
+ // uses the original repl.
16
+ function replStart ( ) {
17
+ return REPL . start . apply ( REPL , arguments ) ;
22
18
}
23
19
24
- // hack for repl require to work properly with node_modules folders
25
- module . paths = require ( 'module' ) . _nodeModulePaths ( module . filename ) ;
26
-
27
20
function createRepl ( env , cb ) {
28
21
const opts = {
29
22
ignoreUndefined : false ,
Original file line number Diff line number Diff line change @@ -32,6 +32,20 @@ const Console = require('console').Console;
32
32
const domain = require ( 'domain' ) ;
33
33
const debug = util . debuglog ( 'repl' ) ;
34
34
35
+ try {
36
+ // hack for require.resolve("./relative") to work properly.
37
+ module . filename = path . resolve ( 'repl' ) ;
38
+ } catch ( e ) {
39
+ // path.resolve('repl') fails when the current working directory has been
40
+ // deleted. Fall back to the directory name of the (absolute) executable
41
+ // path. It's not really correct but what are the alternatives?
42
+ const dirname = path . dirname ( process . execPath ) ;
43
+ module . filename = path . resolve ( dirname , 'repl' ) ;
44
+ }
45
+
46
+ // hack for repl require to work properly with node_modules folders
47
+ module . paths = require ( 'module' ) . _nodeModulePaths ( module . filename ) ;
48
+
35
49
// If obj.hasOwnProperty has been overridden, then calling
36
50
// obj.hasOwnProperty(prop) will break.
37
51
// See: https://github.com/joyent/node/issues/1707
Original file line number Diff line number Diff line change 130
130
// If -i or --interactive were passed, or stdin is a TTY.
131
131
if ( process . _forceRepl || NativeModule . require ( 'tty' ) . isatty ( 0 ) ) {
132
132
// REPL
133
- Module . requireRepl ( ) . createRepl ( process . env , function ( err , repl ) {
133
+ Module . requireRepl ( ) . createInternalRepl ( process . env , function ( err , repl ) {
134
134
if ( err ) {
135
135
throw err ;
136
136
}
You can’t perform that action at this time.
0 commit comments