Hi there !
I have a problem with custom build command since i upgrade to 1.23 on Wind~.
I define my build command as :
command : "C:\Documents and Settings\xxx\Application Data\geany\tools\jsl-0.3.0\jsl.exe" -process "%d\%f" -conf jsl.default.conf
work path : "C:\Documents and Settings\xxx\Application Data\geany\tools\jsl-0.3.0\"
And now with 1.23 it produce an error (in french) :
"C:\Documents and Settings\xxx\Application Data\geany\tools\jsl-0.3.0\jsl.exe" -process "D:\pathToFile\file.js" -conf jsl.default.conf (dans le dossier : "C:\Documents and Settings\xxx\Application Data\geany\tools\jsl-0.3.0\")
'C:\Documents' n'est pas reconnu en tant que commande interne
ou externe, un programme ex cutable ou un fichier de commandes.
If i use single quote instead of double quote i have this message (in french) :
Syntaxe du nom de fichier, de r pertoire ou de volume incorrecte.
I seen in the mailing list there was some changes near the management of quotes in the build command, maybe there is an edge effect for a Wind~ environment.
There is also an error with accentuated character ("ex cutable" / "r pertoire"). maybe it was present on previous version i don't remember
Thanks for your reading and consideration
Not sure if it helps, but there's also
CommandLineToArgvW
which IIUC is the win32 equivalent ofg_shell_parse_argv
.Here is a low-level create_process_with_pipes() for win~1 with a read(std{out,err}) test. No write(stdin) test yet, but I don't expect any problems. A comment in execute.c explains why the err/out may appear mixed (shoudn't be a problem in Geany).
@Lex: I think we need both arguments. For example, FiF has a "grep command", while the text to search is certainly a separate argument, which may contain quotes. I don't want the calling functions to format something (sometimes with bugs, as in the current build.c) just so that I reformat it later. And there's the matter of utils_spawn_[a]sync(), both of which are currently in use.
What I failed to mention is that if both command and argv are present, both will be used, with command_text before argv, and the non-native argument will be converted.
(Yes, SF ate the asterisks).
@Matthew: Argv[A|W]ToCommandLine would have been helpful, but I don't know of any, and haven't seen such a call in the windows crtl-s. The test in execute.c does a crude conversion, but I'll need to inspect this more carefully.
I'm not sure what high level function(s) will be best, for example a sync/async spawn with callbacks instead of out/err fd-s, but in any case I'll create a new module, execute.c or something, and put all spawn related code there (except the client calls, of course). Enough hunting in utils, build, win32 and who knows where else.
Here's an updated version of execute. I'll probably name the new module spawn.[ch], and all functions will have spawn_ prefix. BTW, redirecting one or two of the pipes, while leaving the other(s) intact, seems to be a problem under win~1 - it's either all or none, the documentation of GetStdHandle() suggests otherwise.
The attached archive contains:
Changes since 0.8 which was sent to the ML:
Changes since 0.9:
Note that you can apply the respawn patches separately, like splitdiff -a respawn.diff and then patch Makefile.am and build.c only; win32.[ch] should always be patched last.
There are more calls that require change, for example g_shell_parse_argv (and thus g_spawn_command_line_*) should never be used under Windows directly. But I'll stop the spawning rewrite until the current changes are applied, rejected, fixed, or left to rot, as it sometimes happens.
@Dimitar it'd easier to test/review/merge if you used a Git branch, and ideally made a pull request for the branch on Github so it don't get lost/left to rot.
Fixed with [5c893e9b0eac95cc26f35a5dc279872ff1588f27]: windows command-line spawning has a very strange handling of quotes, whenever there was a space in the executable path and more than 2 quotes in the whole command, it broke.
@Dimitar when next version is out, we'll try your cleaner and better approach. Thanks a lot for that effort BTW.
Related
Commit: [5c893e]
Changes since 1.0:
I'll recreate the git PR soon, but as before, this .zip contains the full version.
Last edit: Dimitar Zhekov 2014-05-18
Changes since 1.01:
geanyvc diff remains at 1.01.
Changes since 1.02:
Updated PR #274 as well.
Changes since 1.03: see github PR 274.
Changes since 1.04: spawn_with_callbacks() rewritten to work with glib watches only, less OS-dependent code, binary I/O, recursive callbacks etc. Better make files for the test program.
Changes since 1.07: see github PR 274.
Changes since 1.08: see github PR 274.
Spawn 1.10 + 2 bug fixes is now included in Geany.