Check if git-daemon exists and execute tests then

This commit is contained in:
Romain Calascibetta 2022-11-02 15:46:53 +01:00
parent 888605dd22
commit cc70aeb3f1
2 changed files with 20 additions and 0 deletions

View file

@ -2,10 +2,21 @@
(package git-kv) (package git-kv)
(applies_to simple) (applies_to simple)
(locks p9418) (locks p9418)
(enabled_if (= "true" {%read:git-daemon}))
(deps %{bin:mgit})) (deps %{bin:mgit}))
(cram (cram
(package git-kv) (package git-kv)
(applies_to fold) (applies_to fold)
(locks p9418) (locks p9418)
(enabled_if (= "true" {%read:git-daemon}))
(deps %{bin:mgit})) (deps %{bin:mgit}))
(executable
(name git_daemon_exists)
(libraries unix))
(rule
(with-stdout-to
git-daemon
(run ./git_daemon_exists.exe)))

View file

@ -0,0 +1,9 @@
let git_daemon_exists () =
match Unix.create_process "git" [| "git"; "daemon" |] Unix.stdin Unix.stdout Unix.stderr with
| pid ->
Unix.kill pid Sys.sigint ; true
| exception Unix.Unix_error _ -> false
let () =
let v = git_daemon_exists () in
Format.printf "%b" v