Skip to content

Commit 968e555

Browse files
committed
Better docs on binary invocation
1 parent 8fcc1ab commit 968e555

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

CONTRIBUTING.md

+10
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@ Snippets are also synced from https://github.com/rescript-lang/rescript-sublime.
5959

6060
These are taken care of by the binary at [rescript-editor-support](https://github.com/rescript-lang/rescript-editor-support). We just invoke it in `RescriptEditorSupport.ts`.
6161

62+
## Binary Invocation
63+
64+
We call a few binaries and it's tricky to call them properly cross-platform. Here are some tips:
65+
66+
- We try to call the binaries synchronously to avoid races.
67+
- Make sure you cater to calling a binary and passing e.g. a path with whitespace in it.
68+
- `execFile` and its sync version do the above for free.
69+
- `execFile` does not work on windows for batch scripts, which is what Node scripts are wrapped in. Use `exec`. See more [here](https://github.com/rescript-lang/rescript-vscode/blob/8fcc1ab428b8225c97d2c9a5b8e3a782c70d9439/server/src/utils.ts#L110).
70+
- Thankfully, many of our binaries are native, so we can keep using `execFile` most of the time.
71+
6272
## Rough Description Of How The Plugin Works
6373

6474
### Editor Diagnostics

0 commit comments

Comments
 (0)