Open ghost opened 5 years ago
Piping seems to create a new file before dub is executed which dub seems to prefer. It should probably prefer dub.sdl over dub.json (or other way around) if one of them is empty
This is not a dub issue, but a common issue when trying to process a file and write to it.
The >
is executed first, opening and clearing the file. Try cat dub.json > dub.json
and you will get the same result.
there is still an issue that dub uses an empty dub.json over a functional dub.sdl with that though
Right, I missed the part where there is only a dub.sdl
and no dub.json
to begin with.
Sounds like a simple enough fix, but it leads to another question: what if dub.json
is malformed ? Or well-formed but doesn't build ? Under which condition(s) should such a fallback happen ?
I would just complain if both contain something and ignore a completely empty one just for this purpose. Though maybe it's not the cleanest way to do. Maybe piping into a different file and moving afterwards would be the cleanest way to do this after all
On linux,
cd
to DUB repository and executeto get an empty json and the message
This is minor issue since to convert to a file we can just do