Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
229 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
include [%matchenv | ||
switch BSB_BACKEND { | ||
| "bytecode" => Commands_native | ||
| "native" => Commands_native | ||
| "js" => Commands_js | ||
} | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
include [%matchenv | ||
switch BSB_BACKEND { | ||
| "bytecode" => Files_native | ||
| "native" => Files_native | ||
| "js" => Files_js | ||
} | ||
]; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
include [%matchenv | ||
switch BSB_BACKEND { | ||
| "bytecode" => Utils_native | ||
| "native" => Utils_native | ||
| "js" => Utils_js | ||
} | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
let now: unit => float; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
|
||
|
||
type proc; | ||
|
||
type job = unit => unit; | ||
|
||
type buffer; | ||
[@bs.module "child_process"] external spawnSync: | ||
(~cmd: string, ~args: array(string), ~options: Js.t({. shell: Js.boolean})) => Js.t({. stdout: buffer, stderr: buffer, status: int}) = ""; | ||
|
||
[@bs.module "child_process"] external spawn: | ||
(~cmd: string, ~args: array(string), ~options: Js.t({. shell: Js.boolean})) => proc = ""; | ||
|
||
[@bs.send] external on: (proc, string, unit => unit) => unit = ""; | ||
[@bs.send] external kill: proc => unit = ""; | ||
[@bs.send] external onData: (proc, string, buffer => unit) => unit = "on"; | ||
|
||
[@bs.send.pipe: buffer] external toString: (string) => string = ""; | ||
|
||
let trimLastNewline = text => if (Js.String.endsWith("\n", text)) { | ||
Js.String.slice(~from=0, ~to_=Js.String.length(text) - 1, text) | ||
} else { | ||
text | ||
}; | ||
|
||
let execSync = (~cmd, ~onOut=a => (), ()) => { | ||
let res = spawnSync(~cmd, ~args=[||], ~options={"shell": Js.true_}); | ||
(res##stdout |> toString("utf8") |> trimLastNewline |> Js.String.split("\n") |> Array.to_list, res##status == 0) | ||
}; | ||
|
||
let exec = (~cmd, ~onOut) => { | ||
let proc = spawn(~cmd, ~args=[||], ~options={"shell": Js.true_}); | ||
() => () | ||
}; | ||
|
||
let run = (job) => (); | ||
let runAll = jobs => (); | ||
let poll = (job) => (); | ||
|
||
let keepAlive = (~cmd, ~onOut=l => (), ~onErr=a => (), ~onStart=() => (), ~checkInterval=1., ()) => { | ||
let save = ref(None); | ||
let rec start = () => { | ||
Js.log("starting"); | ||
onStart(); | ||
let proc = spawn(~cmd, ~args=[||], ~options={"shell": Js.true_}); | ||
on(proc, "close", () => { | ||
Js.log("close"); | ||
Js.Global.setTimeout(() => { | ||
save := Some(start()); | ||
Js.log("AAA"); | ||
}, int_of_float(checkInterval *. 1000.)) |> ignore; | ||
}); | ||
proc | ||
}; | ||
let kill = () => { | ||
switch save^ { | ||
| Some(p) => kill(p) | ||
| None => () | ||
} | ||
}; | ||
save := Some(start()); | ||
kill | ||
}; | ||
|
||
let kill = (job) => job(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
let now = () => Js.Date.now() /. 1000.; |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
let now = Unix.gettimeofday; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
open Test_shared; | ||
|
||
report(); |
Oops, something went wrong.