add read permission check to cat command
This commit is contained in:
parent
2f3ccae2f4
commit
3db714b153
|
@ -23,6 +23,9 @@ module.exports = (argv, terminal) => {
|
||||||
terminal.writeln(`${argv[0]}: ${file}: no such file or directory`);
|
terminal.writeln(`${argv[0]}: ${file}: no such file or directory`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!fs.accessSync(file, fs.constants.R_OK)) {
|
||||||
|
terminal.writeln(`${argv[0]}: read ${file}: access denied`);
|
||||||
|
}
|
||||||
const lines = fs.readFileSync(file).toString().split('\n');
|
const lines = fs.readFileSync(file).toString().split('\n');
|
||||||
|
|
||||||
if (numbers) {
|
if (numbers) {
|
||||||
|
|
Loading…
Reference in New Issue