I'm trying to compare the output of my fizzbuzz.js program:
for (let i = 1; i <= 100; i++) {
let out = "";
if (i % 3 == 0) out += "Fizz";
if (i % 5 == 0) out += "Buzz";
if (i % 3 && i % 5) out = i;
console.log(out);
}
with the contents of a expected-output.txt file which contains:
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
[...]
I can't get process substitution to work:
diff -u expected-output.txt <(node fizzbuzz.js)
seems to hang indefinitely. What could be causing this?
My environment is macOS Mojave, bash 3.2.57, node v12.5.0.
EDIT: this seems to be a macOS issue. Everything works fine on a Ubuntu 18.04 machine with newer bash 4.4.19