We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e785ce0 commit 9139868Copy full SHA for 9139868
1 file changed
implement-shell-tools/cat/cat.mjs
@@ -13,18 +13,19 @@ program.parse();
13
const options = program.opts();
14
const paths = program.args;
15
16
+let hadError = false;
17
for(const path of paths){
18
let content;
19
try {
20
content = await fs.readFile(path, "utf-8")
21
} catch(err) {
22
console.error(`Error reading file "${path}": ${err.message} `);
23
+ hadError = true;
24
continue;
25
}
26
27
// split file into lines
28
let lines = content.replace(/\n$/, "").split("\n");
-
29
let lineNum = 1;
30
31
for (const line of lines){
@@ -42,4 +43,6 @@ for(const path of paths){
42
43
console.log(`${line}`)
44
45
-}
46
+}
47
+
48
+if (hadError) process.exit(1);
0 commit comments