File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 11'use strict' ;
22
33const common = require ( '../common' ) ;
4+ const tmpdir = require ( '../common/tmpdir' ) ;
45const assert = require ( 'assert' ) ;
5-
66const spawn = require ( 'child_process' ) . spawn ;
7+ const path = require ( 'path' ) ;
8+
9+ tmpdir . refresh ( ) ;
10+
11+ const requirePath = JSON . stringify ( path . join ( tmpdir . path , 'non-existent.json' ) ) ;
12+
713// Use -i to force node into interactive mode, despite stdout not being a TTY
814const child = spawn ( process . execPath , [ '-i' ] ) ;
915
1016let out = '' ;
11- const input = " try { require('./non-existent.json' ); } catch {} " +
12- " require('fs').writeFileSync('./non-existent.json' , '1');" +
13- " require('./non-existent.json');" ;
17+ const input = ` try { require(${ requirePath } ); } catch {} ` +
18+ ` require('fs').writeFileSync(${ requirePath } , '1');` +
19+ ` require(${ requirePath } );` ;
1420
1521child . stderr . on ( 'data' , common . mustNotCall ( ) ) ;
1622
You can’t perform that action at this time.
0 commit comments