Windows: correctly redirect stderr to stdout of called ppx #1413
Windows: correctly redirect stderr to stdout of called ppx #1413let-def merged 1 commit intoocaml:masterfrom
Conversation
994d899 to
c37d756
Compare
c37d756 to
2e0bc5c
Compare
2e0bc5c to
0be39d4
Compare
|
I think with the latest push the code should be right: we still need to quote the arguments given to the program, we add |
nojb
left a comment
There was a problem hiding this comment.
Looks good, but I think there are a couple of points to correct (and a stylistic suggestion).
0be39d4 to
8eed93b
Compare
|
Thanks for the thorough review! A lot of omissions on my end... |
nojb
left a comment
There was a problem hiding this comment.
LGTM. I can give this a try on my setup a bit later today and confirm that it works.
nojb
left a comment
There was a problem hiding this comment.
I tried it very briefly and it seems to work. LGTM.
8eed93b to
8733ca0
Compare
Done. |
Redirect the stdout of the child process to which of the parent (as posix system(3)), and the stderr of the child to the stdout of the child (as merlin's ppx_commandline). Setting up the redirection in the parent process has the downside that we must set the bInheritHandles flag of CreateProcess, which means that if merlin doesn't set a handle non-inheritable (close-on-exec), the ppx process will have access to it. Reorder a bit the logging to print the parameters the ppx is called with, and use an Unicode environment for the child process.
8733ca0 to
bf8e7b0
Compare
|
Thank you ;). |
|
@MisterDA should we backport this patch to Merlin for OCaml 411 and/or 412 in your opinion ? |
|
Yes. Merlin is still usable, but without the patch is broken when using ppx's. It cannot do anything when the code is in extension points (so that breaks for instance lwt_ppx or ppx_expect) or cannot show the type of functions generated by derivers (for instance ppx_sexp or yojson). I ignored errors on derivers, but on extension points it's more annoying not to be able to use Merlin on bigger chunks of code. |
CHANGES:
Tue Apr 5 20:59:42 CEST 2020
+ merlin binary
- don't reset the environment when running merlin in single mode so that the
parent environement is forwarded the the child processes (ocaml/merlin#1425)
- filter dups in source paths (ocaml/merlin#1218)
- improve load path performance (ocaml/merlin#1323)
- fix handlink of ppx's under Windows (ocaml/merlin#1413)
- locate: look for original source files before looking for preprocessed
files (ocaml/merlin#1219 by @ddickstein, fixes ocaml/merlin#894)
- handle `=` syntax in compiler flags (ocaml/merlin#1409)
- expose all destruct exceptions in the api (ocaml/merlin#1437)
- fix superfluous break in error reporting (ocaml/merlin#1432)
- recognise binding operators in locate and occurrences (ocaml/merlin#1398, @mattiase)
- remove dependency on Result (ocaml/merlin#1441, @kit-ty-kate)
+ editor modes
- fix an issue in Neovim where the current line jumps to the top of the
window on repeated calls to `MerlinTypeOf` (ocaml/merlin#1433 by @ddickstein, fixes
ocaml/merlin#1221)
- add module, module type, and class imenu items for emacs (ocaml/merlin#1244, @ivg)
- add prefix argument to force or prevent opening in a new buffer in locate
command (ocaml/merlin#1426, @panglesd)
- add type-on-hover functionality for vim (ocaml/merlin#1439, @nilsbecker)
- add a dedicated buffer `*merlin-errors*` containing the last viewed error
(ocaml/merlin#1414, @panglesd)
+ test suite
- make `merlin-wrapper` create a default `.merlin` file only when there is
no `dune-project` to let tests use `dune ocaml-merlin` reader. (ocaml/merlin#1425)
- cover locate calls on module aliases with and without dune
- Add a test expliciting the interaction between locate and Dune's generated
source files (ocaml/merlin#1444)
CHANGES:
Tue Apr 5 21:12:42 CEST 2022
+ merlin binary
- don't reset the environment when running merlin in single mode so that the
parent environement is forwarded the the child processes (ocaml/merlin#1425)
- locate: look for original source files before looking for preprocessed
files (ocaml/merlin#1219 by @ddickstein, fixes ocaml/merlin#894)
- fix handlink of ppx's under Windows (ocaml/merlin#1413)
- handle `=` syntax in compiler flags (ocaml/merlin#1409)
- fix superfluous break in error reporting (ocaml/merlin#1432)
- recognise binding operators in locate and occurrences (ocaml/merlin#1398, @mattiase)
- improve load path performance (ocaml/merlin#1323)
- remove dependency on Result (ocaml/merlin#1441, @kit-ty-kate)
+ editor modes
- fix an issue in Neovim where the current line jumps to the top of the
window on repeated calls to `MerlinTypeOf` (ocaml/merlin#1433 by @ddickstein, fixes
ocaml/merlin#1221)
- add module, module type, and class imenu items for emacs (ocaml/merlin#1244, @ivg)
- add prefix argument to force or prevent opening in a new buffer in locate
command (ocaml/merlin#1426, @panglesd)
- add type-on-hover functionality for vim (ocaml/merlin#1439, @nilsbecker)
- add a dedicated buffer `*merlin-errors*` containing the last viewed error
(ocaml/merlin#1414, @panglesd)
+ test suite
- make `merlin-wrapper` create a default `.merlin` file only when there is
no `dune-project` to let tests use `dune ocaml-merlin` reader. (ocaml/merlin#1425)
CHANGES:
Tue Apr 5 21:17:21 PM CET 2022
+ merlin binary
- don't reset the environment when running merlin in single mode so that the
parent environement is forwarded the the child processes (ocaml/merlin#1425)
- locate: look for original source files before looking for preprocessed
files (ocaml/merlin#1219 by @ddickstein, fixes ocaml/merlin#894)
- fix handling of ppx's under Windows (ocaml/merlin#1413)
- handle `=` syntax in compiler flags (ocaml/merlin#1409)
- fix superfluous break in error reporting (ocaml/merlin#1432)
- recognise binding operators in locate and occurrences (ocaml/merlin#1398, @mattiase)
- remove dependency on Result (ocaml/merlin#1441, @kit-ty-kate)
+ editor modes
- update quick setup instructions for emacs (ocaml/merlin#1380, @ScriptDevil)
- fix an issue in Neovim where the current line jumps to the top of the
window on repeated calls to `MerlinTypeOf` (ocaml/merlin#1433 by @ddickstein, fixes
ocaml/merlin#1221)
- add module, module type, and class imenu items for emacs (ocaml/merlin#1244, @ivg)
- add prefix argument to force or prevent opening in a new buffer in locate
command (ocaml/merlin#1426, @panglesd)
- add type-on-hover functionality for vim (ocaml/merlin#1439, @nilsbecker)
- add a dedicated buffer `*merlin-errors*` containing the last viewed error
(ocaml/merlin#1414, @panglesd)
+ test suite
- make `merlin-wrapper` create a default `.merlin` file only when there is
no `dune-project` to let tests use `dune ocaml-merlin` reader. (ocaml/merlin#1425)
CHANGES for 414:
Tue Apr 5 20:51:42 CEST 2022
+ merlin binary
- don't reset the environment when running merlin in single mode so that the
parent environement is forwarded the the child processes (ocaml/merlin#1425)
- filter dups in source paths (ocaml/merlin#1218)
- improve load path performance (ocaml/merlin#1323)
- fix handlink of ppx's under Windows (ocaml/merlin#1413)
- locate: look for original source files before looking for preprocessed
files (ocaml/merlin#1219 by @ddickstein, fixes ocaml/merlin#894)
- handle `=` syntax in compiler flags (ocaml/merlin#1409)
- expose all destruct exceptions in the api (ocaml/merlin#1437)
- fix superfluous break in error reporting (ocaml/merlin#1432)
- recognise binding operators in locate and occurrences (ocaml/merlin#1398, @mattiase)
- remove dependency on Result (ocaml/merlin#1441, @kit-ty-kate)
- use the new "shapes" generated by the compiler to perform precise
jump-to-definition (ocaml/merlin#1431)
+ editor modes
- fix an issue in Neovim where the current line jumps to the top of the
window on repeated calls to `MerlinTypeOf` (ocaml/merlin#1433 by @ddickstein, fixes
ocaml/merlin#1221)
- add module, module type, and class imenu items for emacs (ocaml/merlin#1244, @ivg)
- add prefix argument to force or prevent opening in a new buffer in locate
command (ocaml/merlin#1426, @panglesd)
- add type-on-hover functionality for vim (ocaml/merlin#1439, @nilsbecker)
- add a dedicated buffer `*merlin-errors*` containing the last viewed error
(ocaml/merlin#1414, @panglesd)
+ test suite
- make `merlin-wrapper` create a default `.merlin` file only when there is
no `dune-project` to let tests use `dune ocaml-merlin` reader. (ocaml/merlin#1425)
- cover locate calls on module aliases with and without dune
- Add a test expliciting the interaction between locate and Dune's generated
source files (ocaml/merlin#1444)
CHANGES for 413:
Tue Apr 5 20:59:42 CEST 2022
+ merlin binary
- don't reset the environment when running merlin in single mode so that the
parent environement is forwarded the the child processes (ocaml/merlin#1425)
- filter dups in source paths (ocaml/merlin#1218)
- improve load path performance (ocaml/merlin#1323)
- fix handlink of ppx's under Windows (ocaml/merlin#1413)
- locate: look for original source files before looking for preprocessed
files (ocaml/merlin#1219 by @ddickstein, fixes ocaml/merlin#894)
- handle `=` syntax in compiler flags (ocaml/merlin#1409)
- expose all destruct exceptions in the api (ocaml/merlin#1437)
- fix superfluous break in error reporting (ocaml/merlin#1432)
- recognise binding operators in locate and occurrences (ocaml/merlin#1398, @mattiase)
- remove dependency on Result (ocaml/merlin#1441, @kit-ty-kate)
+ editor modes
- fix an issue in Neovim where the current line jumps to the top of the
window on repeated calls to `MerlinTypeOf` (ocaml/merlin#1433 by @ddickstein, fixes
ocaml/merlin#1221)
- add module, module type, and class imenu items for emacs (ocaml/merlin#1244, @ivg)
- add prefix argument to force or prevent opening in a new buffer in locate
command (ocaml/merlin#1426, @panglesd)
- add type-on-hover functionality for vim (ocaml/merlin#1439, @nilsbecker)
- add a dedicated buffer `*merlin-errors*` containing the last viewed error
(ocaml/merlin#1414, @panglesd)
+ test suite
- make `merlin-wrapper` create a default `.merlin` file only when there is
no `dune-project` to let tests use `dune ocaml-merlin` reader. (ocaml/merlin#1425)
- cover locate calls on module aliases with and without dune
- Add a test expliciting the interaction between locate and Dune's generated
source files (ocaml/merlin#1444)
CHANGES for 412:
Tue Apr 5 21:12:42 CEST 2022
+ merlin binary
- don't reset the environment when running merlin in single mode so that the
parent environement is forwarded the the child processes (ocaml/merlin#1425)
- locate: look for original source files before looking for preprocessed
files (ocaml/merlin#1219 by @ddickstein, fixes ocaml/merlin#894)
- fix handlink of ppx's under Windows (ocaml/merlin#1413)
- handle `=` syntax in compiler flags (ocaml/merlin#1409)
- fix superfluous break in error reporting (ocaml/merlin#1432)
- recognise binding operators in locate and occurrences (ocaml/merlin#1398, @mattiase)
- improve load path performance (ocaml/merlin#1323)
- remove dependency on Result (ocaml/merlin#1441, @kit-ty-kate)
+ editor modes
- fix an issue in Neovim where the current line jumps to the top of the
window on repeated calls to `MerlinTypeOf` (ocaml/merlin#1433 by @ddickstein, fixes
ocaml/merlin#1221)
- add module, module type, and class imenu items for emacs (ocaml/merlin#1244, @ivg)
- add prefix argument to force or prevent opening in a new buffer in locate
command (ocaml/merlin#1426, @panglesd)
- add type-on-hover functionality for vim (ocaml/merlin#1439, @nilsbecker)
- add a dedicated buffer `*merlin-errors*` containing the last viewed error
(ocaml/merlin#1414, @panglesd)
+ test suite
- make `merlin-wrapper` create a default `.merlin` file only when there is
no `dune-project` to let tests use `dune ocaml-merlin` reader. (ocaml/merlin#1425)
CHANGES for 411:
Tue Apr 5 21:17:21 PM CET 2022
+ merlin binary
- don't reset the environment when running merlin in single mode so that the
parent environement is forwarded the the child processes (ocaml/merlin#1425)
- locate: look for original source files before looking for preprocessed
files (ocaml/merlin#1219 by @ddickstein, fixes ocaml/merlin#894)
- fix handling of ppx's under Windows (ocaml/merlin#1413)
- handle `=` syntax in compiler flags (ocaml/merlin#1409)
- fix superfluous break in error reporting (ocaml/merlin#1432)
- recognise binding operators in locate and occurrences (ocaml/merlin#1398, @mattiase)
- remove dependency on Result (ocaml/merlin#1441, @kit-ty-kate)
+ editor modes
- update quick setup instructions for emacs (ocaml/merlin#1380, @ScriptDevil)
- fix an issue in Neovim where the current line jumps to the top of the
window on repeated calls to `MerlinTypeOf` (ocaml/merlin#1433 by @ddickstein, fixes
ocaml/merlin#1221)
- add module, module type, and class imenu items for emacs (ocaml/merlin#1244, @ivg)
- add prefix argument to force or prevent opening in a new buffer in locate
command (ocaml/merlin#1426, @panglesd)
- add type-on-hover functionality for vim (ocaml/merlin#1439, @nilsbecker)
- add a dedicated buffer `*merlin-errors*` containing the last viewed error
(ocaml/merlin#1414, @panglesd)
+ test suite
- make `merlin-wrapper` create a default `.merlin` file only when there is
no `dune-project` to let tests use `dune ocaml-merlin` reader. (ocaml/merlin#1425)
There's no need for quoting the files as we're not calling the ppx
through a shell.
Redirect the stderr of the child process to which of the parent (as
posix
system(3)), and the stdout of the child to the stderr of thechild (as merlin's
ppx_commandline).Setting up the redirection in the parent process has the downside that
we must set the
bInheritHandlesflag ofCreateProcess, which meansthat if merlin leaks a handle (not setting it non-inheritable /
cloexec), the ppx process will have access to it.
cc @let-def @nojb