-
Notifications
You must be signed in to change notification settings - Fork 1
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
quote open command with Filename.quote_command and return Lwt process #2
base: master
Are you sure you want to change the base?
Conversation
Alternatively, you could add a wrapper |
Thanks for the PR, Nathan. Very nice to get the quoting issue fixed and to have Lwt support. Two requests:
Regarding (2), unfortunately I am not an expert on how to best achieve this since I don't use Lwt/Async myself, but I know that many libraries provide multiple packages to achieve this somehow...say Regarding (1), perhaps |
…ges: one with Lwt and one without
I factored this in two packages, val in_default_app : string -> bool (* or bool Lwt.t *)
val in_default_app_status : string -> Unix.process_status (* or Unix.process_status Lwt.t *) I also had to update the tests, which now build conditionally on dependencies. (I couldn't figure out the Core dependency so I just replaced some of the code with Stdlib builtins). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks great! Just a few nits / comments.
src/open_lwt.ml
Outdated
@@ -0,0 +1,11 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: remove empty line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for the other new files
@@ -1,11 +1,32 @@ | |||
(executable | |||
(name graphviz) | |||
(libraries open core)) | |||
(enabled_if (>= %{ocaml_version} 4.14.0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, why do we neee OCaml 4.14 here?
dune-project
Outdated
(generate_opam_files true) | ||
|
||
(name open) | ||
(version 0.2.2) | ||
(version 0.3.0) | ||
(license MIT) | ||
(source (github smolkaj/ocaml-open)) | ||
(authors "Steffen Smolka <[email protected]>") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to add yourself as an author.
examples/graphviz/graphviz.ml
Outdated
|> Open.in_default_app | ||
|> Format.printf "file opened successfully: %b\n" | ||
;; | ||
let _ = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: let ()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for the let version
Unfortunately the continuous integration seems to no longer be working, I opened #3 to track that. I can give this PR a try manually so we don't have to block on that issue. |
It works fine on my machine, macOS, with Ocaml 5.0 |
Actually I've been having issues getting dune to skip the examples when lwt is not installed, so I will have to find a way around that. |
Fixed |
I actually think that might be fine? I just don't want the non-Lwt opam package to depend on lwt, and you have achieved that AFAIK. |
I'm afraid opam CI will complain (but not sure). |
I'd be happy either way. No rush on my side. |
Looks like dune 3.9 with the patch you mentioned just got release :) |
Addresses issue #1.
Changes:
Filename.quote_command
instead of sprintf to quoteLwt_process.exec
builtin functionality to redirect output to /dev/nullI similarly ran into the issue that strings were incorrectly quoted. For example, the original code produced
but the system does not recognize this filename. We should instead have