Skip to content

Commit

Permalink
Progress with windows compat
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenldl committed Jun 29, 2024
1 parent 8d5b7b4 commit 0a0300a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion bin/docfd.ml
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,11 @@ let run
term
) else (
let input =
Unix.(openfile "/dev/tty" [ O_RDWR ] 0o666)
if Sys.win32 then (
Unix.(openfile "CON" [ O_RDONLY ] 0o444)
) else (
Unix.(openfile "/dev/tty" [ O_RDONLY ] 0o444)
)
in
let term = Notty_unix.Term.create ~input () in
term_and_tty_fd := Some (term, Some input);
Expand Down
6 changes: 4 additions & 2 deletions bin/proc_utils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ open Misc_utils

let command_exists (cmd : string) : bool =
if Sys.win32 then
Sys.command (Fmt.str "where %s 2>/dev/null 1>/dev/null" (Filename.quote cmd)) = 0
Sys.command (Fmt.str "where %s 2>nul 1>nul" (Filename.quote cmd)) = 0
else
Sys.command (Fmt.str "command -v %s 2>/dev/null 1>/dev/null" (Filename.quote cmd)) = 0

Expand All @@ -13,7 +13,9 @@ let run_in_background (cmd : string) =
Sys.command (Fmt.str "%s 2>/dev/null 1>/dev/null &" cmd)

let run_return_stdout ~proc_mgr ~fs (cmd : string list) : string list option =
Eio.Path.(with_open_out ~create:`Never (fs / "/dev/null"))
Eio.Path.(with_open_out
~create:`Never
(fs / (if Sys.win32 then "nul" else "/dev/null")))
(fun stderr ->
let output =
try
Expand Down

0 comments on commit 0a0300a

Please sign in to comment.