Open f-f opened 1 year ago
This may require changes in node-execa
first as I don't think it'll handle multi-line shebangs properly right now (or this might only be the case on Windows). See https://github.com/JordanMartinez/purescript-node-execa/blob/master/src/Node/Library/Execa/CrossSpawn.purs#L181-L188
This should now be unblocked?
Yes and no. For Linux/Mac, this is unblocked. For Windows, this is unblocked but may not work correctly in all cases. In node-execa
(as noted above), we only read the first 150 bytes of a file. If there are multi-line shebangs that make up the entire command, we'll drop some of that on Windows.
Do we know why that 150? Is that just a number that is deemed "good enough" to read all the shebang lines?
Is that just a number that is deemed "good enough" to read all the shebang lines?
AFAICT, yes. That's what was in the original code. I can't recall whether there was a comment explaining why.
150 chars should be quite enough for the majority of cases, we can try shipping this and come back to bump it if we ever figure out it's not enough
It's your call.
Let's
A question/proposal: instead of (or in addition to) specifying package set and dependencies on the command line, how about supporting them via pragmas in the file itself? Haskell Stack does that to an extent, but I don't like the command-line syntax, I think F# does it much better.
And speaking of F#: it has another pragma #load
that allows to have multi-module scripts, and could be trivially implemented in Spago - just copy all those #load
ed files to the same temp dir.
I don't have a strong opinion on this, except for the fact that whatever we add in .purs
files needs to be supported by the parser. E.g. when we introduced spago script
for the Haskell implementation we had to patch the parser
Yes, of course, the pragmas would look like comments to the compiler.
The Haskell patch was for shebang lines, not the pragmas. Pragmas in Haskell files are also just comments, no patch would be needed for them.
And while I wasn't actually proposing to support shebangs as well, it can also be easily done: as long as we're copying the files to a different location anyway, we can just cut off the shebang lines along the way.
Still needs to be ported from the Haskell implementation, see here