If I have this task in a nimble file:
task readme, "generate README.md":
exec "nim c -r readme.nim > README.md"
with this readme.nim:
echo "# Hello\nworld"
executing task with nimble (nimble readme) does not redirect the output of readme.nim to file.
As expected running nim c -r readme.nim > README.md from terminal correctly creates/updates README.md.
Is this intended behaviour of nimble? is there a workaround?
note: the above was tested on windows.
thanks to answer by @xbello and ensuing discussion, I found a good workaround for my use case:
the explanation to why the simple
exechas to do with the fact that nimble uses nimscript.exec which internally usesrawExecwhich is a builtin that (judging from different behaviours reported here for windows and linux) is not entirely cross-platform when it regards output pipeline.