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 d8c098f commit f6c367cCopy full SHA for f6c367c
implement-shell-tools/wc/wc.mjs
@@ -17,13 +17,15 @@ const paths = program.args;
17
let totalLines = 0;
18
let totalWords = 0;
19
let totalBytes = 0;
20
+let hadError = false;
21
22
for(const path of paths){
23
let content;
24
try{
25
content = await fs.readFile(path, "utf-8");
26
} catch (err){
27
console.error(`Error reading file "${path}":`, err.message);
28
+ hadError = true;
29
continue;
30
}
31
@@ -62,4 +64,6 @@ if (paths.length > 1) {
62
64
} else {
63
65
console.log(`\t${totalLines}\t${totalWords}\t${totalBytes} total`);
66
-}
67
+}
68
+
69
+if (hadError) process.exit(1);
0 commit comments