purescript-deprecated / gulp-purescript

Gulp plugin providing PureScript compiler tasks
34 stars 8 forks source link

"The command line is too long" when using cross-spawn #36

Closed garyb closed 9 years ago

garyb commented 9 years ago

Unfortunately it looks like using cross-spawn may solve one problem, but introduce another. I can no-longer compile purescript-transformers on Windows without receiving:

Error: The command line is too long

Switching back to child_process fixes this, so I'm not really sure what to suggest here.

garyb commented 9 years ago

Using cross-spawn isn't tipping the command line for transformers over some edge by the way, slamdata is made up of nearly 5 times as many modules as transformers, and compiling that with an older version of the gulp task works fine.

garyb commented 9 years ago

Although having said that, there is a hard limit of 8191 characters for command line arguments on Windows, so maybe we'd be better off doing something in the compiler to fix this.

ethul commented 9 years ago

Thanks for bringing this up. I admit I am unsure of the best resolution at the moment. I will investigate a bit on this, but I am open to suggestions.

garyb commented 9 years ago

Actually, I'm totally confused now. :smile:

slamdata currently generates a command line argument of 32140 characters which executes completely fine, so I'm not sure how that's possible if the claimed 8191 limit is real.

From looking at cross-spawn, it appears to execute everything via arguments to cmd.exe so I assume the issue arises from that somehow.

ethul commented 9 years ago

As experiment, would you be able to add anything to bump the command line argument length to 32767 characters (or preferably more)? I was reading that 32767 may be the maximum. If this fails, I wonder if the best solution may be to support reading the arguments from a file in the compiler.

For example, gcc allows for the following syntax (http://linux.die.net/man/1/gcc):

@file

Read command-line options from file. The options read are inserted in place of the original @file option. If file does not exist, or cannot be read, then the option will be treated literally, and not removed.

Options in file are separated by whitespace. A whitespace character may be included in an option by surrounding the entire option in either single or double quotes. Any character (including a backslash) may be included by prefixing the character to be included with a backslash. The file may itself contain additional @file options; any such options will be processed recursively.

And if gulp-purescript always forced the @file syntax, it may remove the need for cross-spawn.

garyb commented 9 years ago

Yeah, that indeed pushes it over with an ENAMETOOLONG. Looks like we'll have to go with the args file option, or perhaps allowing glob paths in the compiler arguments.

Thanks for looking into it!

ethul commented 9 years ago

Welcome. Thanks for testing. Sounds good regarding the compiler feature.