Question: How do I output `crystal build` to standard output?

I tried specifying hyphens but it did not work.

crystal build -o -

Motivation: I would like to output WebAssembly to standard output.

I don’t think the compiler supports that directly. It expects compiled programs are stored in a file.

But I suppose you should be able to direct the compiler to write to stdout by using /dev/stdout (or CON on Windows) as file name.

1 Like