Description
-
is special and indicates stdin; it shouldn't be used as output filename. -
is bad because it breaks many shell commands, eg: ls -
requires quoting.
Example
echo 'echo 0.3' | nim c -r -
Current Output
creates a file ./-
in current dir: $PWD/-
Expected Output
in nim 0.18.0 it used to create ./stdinfile
; that's better; however IMO it should be hidden inside nimcache.
-
option 1 (simple, and should probably be implemented first)
create a$nimcache/@stdin & $exeExt
-
option 2
creates a temporary file$nimcache/$random & $exeExt
(random so it won't clobber in case other commands are run simultaneously while a program is executing etc, even though os would make it safe in that case but still)
the temporary file would auto-delete upon child process exiting
Additional Information
-
recent devel 1.1.1 e441542
-
as noted Passing code via stdin to Nim stopped working [regression Nim 0.19+] #11294 (comment)
You can always use /dev/stdin instead of -.
(but - should still work)