This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
23
unikernel/duniverse/lwt/test/test_unix.ml
Normal file
23
unikernel/duniverse/lwt/test/test_unix.ml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
(* This file is part of Lwt, released under the MIT license. See LICENSE.md for
|
||||
details, or visit https://github.com/ocsigen/lwt/blob/master/LICENSE.md. *)
|
||||
|
||||
|
||||
|
||||
let temp_name =
|
||||
let rng = Random.State.make_self_init () in
|
||||
fun () ->
|
||||
let number = Random.State.int rng 10000 in
|
||||
Printf.sprintf "lwt-testing-%04d" number
|
||||
|
||||
let temp_file () =
|
||||
Filename.temp_file ~temp_dir:"." "lwt-testing-" ""
|
||||
|
||||
let temp_directory () =
|
||||
let rec attempt () =
|
||||
let path = temp_name () in
|
||||
try
|
||||
Unix.mkdir path 0o755;
|
||||
path
|
||||
with Unix.Unix_error (Unix.EEXIST, "mkdir", _) -> attempt ()
|
||||
in
|
||||
attempt ()
|
||||
Loading…
Add table
Add a link
Reference in a new issue