From 89acd8a4a66689b00375afeae0de59964714b770 Mon Sep 17 00:00:00 2001 From: b1ek Date: Thu, 16 Mar 2023 17:17:11 +1000 Subject: [PATCH] cat dont throw exception on file not found --- react/resume/src/emulator/commands/cat.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/react/resume/src/emulator/commands/cat.js b/react/resume/src/emulator/commands/cat.js index bdacf30..5301052 100644 --- a/react/resume/src/emulator/commands/cat.js +++ b/react/resume/src/emulator/commands/cat.js @@ -19,6 +19,10 @@ module.exports = (argv, terminal) => { let files = argv.filter(x => { return !x.startsWith('-') }); files.shift(); files.forEach(file => { + if (!fs.existsSync(file)) { + terminal.writeln(`${argv[0]}: ${file}: no such file or directory`); + return; + } const lines = fs.readFileSync(file).toString().split('\n'); if (numbers) {