New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More robust determination of full path to current executable #795

merged 3 commits into from Sep 15, 2016
Jump to file or symbol
Failed to load files and symbols.
+6 −2
Diff settings


Just for now

Viewing a subset of changes. View all

Yoda comments on the mysteries of this code.

  • Loading branch information...
xavierleroy committed Sep 5, 2016
commit 72d7dd734e314a16d010bbb24a0e28df31b5bc71
@@ -310,8 +310,12 @@ CAMLexport void caml_main(char **argv)
exe_name = argv[0];
fd = caml_attempt_open(&exe_name, &trail, 0);
/* Should we really do that at all? The current executable is ocamlrun
itself, it's never a bytecode program. */
/* Little grasshopper wonders why we do that at all, since
"The current executable is ocamlrun itself, it's never a bytecode
program". Little grasshopper "ocamlc -custom" in mind should keep.
With -custom, we have an executable that is ocamlrun itself
concatenated with the bytecode. So, if the attempt with argv[0]
failed, it is worth trying again with executable_name. */
if (fd < 0 && (proc_self_exe = caml_executable_name()) != NULL) {
exe_name = proc_self_exe;
fd = caml_attempt_open(&exe_name, &trail, 0);
ProTip! Use n and p to navigate between commits in a pull request.