Skip to content

Commit e1e8b56

Browse files
committed
codecrafters submit [skip ci]
1 parent 248d396 commit e1e8b56

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

β€Žapp/main.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const readline = require("readline");
22

3-
const commands = [];
3+
const commands = ["exit"];
44

55
let terminal = true;
66

@@ -14,11 +14,12 @@ const promptUser = () => {
1414
const command = answer.split(" ")[0];
1515
if (!commands.includes(command)) {
1616
console.log(`${command}: command not found`);
17+
} else if (command === "exit") {
18+
rl.close();
19+
process.exit(0);
1720
}
1821
if (terminal) {
1922
promptUser();
20-
} else {
21-
rl.close();
2223
}
2324
});
2425
};

0 commit comments

Comments
 (0)