Skip to content

Commit 9b79bbc

Browse files
committed
apply suggestions from @redyetidev code review
1 parent 24205e8 commit 9b79bbc

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

doc/api/readline.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -714,8 +714,10 @@ const rl = createInterface({
714714

715715
```cjs
716716
const { createInterface } = require('node:readline/promises');
717-
const { stdin: input, stdout: output } = require('node:process');
718-
const rl = createInterface({ input, output });
717+
const rl = createInterface({
718+
input: process.stdin,
719+
output: process.stdout,
720+
});
719721
```
720722

721723
Once the `readlinePromises.Interface` instance is created, the most common case
@@ -978,8 +980,10 @@ const rl = createInterface({
978980

979981
```cjs
980982
const { createInterface } = require('node:readline');
981-
const { stdin: input, stdout: output } = require('node:process');
982-
const rl = createInterface({ input, output });
983+
const rl = createInterface({
984+
input: process.stdin,
985+
output: process.stdout,
986+
});
983987
```
984988

985989
Once the `readline.Interface` instance is created, the most common case is to
@@ -1141,10 +1145,9 @@ rl.on('line', (line) => {
11411145

11421146
```cjs
11431147
const { createInterface } = require('node:readline');
1144-
const { exit, stdin, stdout } = require('node:process');
11451148
const rl = createInterface({
1146-
input: stdin,
1147-
output: stdout,
1149+
input: process.stdin,
1150+
output: process.stdout,
11481151
prompt: 'OHAI> ',
11491152
});
11501153

@@ -1162,7 +1165,7 @@ rl.on('line', (line) => {
11621165
rl.prompt();
11631166
}).on('close', () => {
11641167
console.log('Have a great day!');
1165-
exit(0);
1168+
process.exit(0);
11661169
});
11671170
```
11681171

0 commit comments

Comments
 (0)