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 1e95feb commit 4cb8e57Copy full SHA for 4cb8e57
1 file changed
implement-shell-tools/wc/customWc.js
@@ -26,6 +26,8 @@ let totalLines = 0;
26
let totalWords = 0;
27
let totalBytes = 0;
28
29
+let hadError = false;
30
+
31
async function countFiles(file) {
32
try {
33
const buffer = await fs.readFile(file);
@@ -48,7 +50,7 @@ async function countFiles(file) {
48
50
process.stdout.write(`${result} ${file}\n`);
49
51
} catch (error) {
52
console.error(`cwc: ${file}: ${error.message}`);
- process.exit(1);
53
+ hadError = true;
54
}
55
56
@@ -66,4 +68,6 @@ async function countFiles(file) {
66
68
67
69
process.stdout.write(`${total} total\n`);
70
71
72
+ if (hadError) process.exit(1);
73
})();
0 commit comments