cat dont throw exception on file not found

This commit is contained in:
b1ek 2023-03-16 17:17:11 +10:00
parent 589fd08c61
commit 89acd8a4a6
Signed by: blek
GPG Key ID: 14546221E3595D0C
1 changed files with 4 additions and 0 deletions

View File

@ -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) {