terminal user interface to jujutsu. Focused on speed and clarity
9
fork

Configure Feed

Select the types of activity you want to include in your feed.

Prevent orphaned jj processes by always cancelling Had to update picos becasue of the changes that made finally not cancellable

+28 -14
+3 -3
flake.nix
··· 45 45 src = ./forks/notty/.; 46 46 }); 47 47 picos_src = pkgs.fetchFromGitHub { 48 - 49 48 owner = "ocaml-multicore"; 50 49 repo = "picos"; 51 - rev = "0.5.0"; 52 - sha256 = "sha256-dbqY/Q+KTWRIJyYi6TqtnU1dLcr/C/F+k4tGG3ISJWI="; 50 + rev = "1ba3357ec7ca56b9bbeb251904636e3453ff2c32"; 51 + sha256 = "sha256-I0PFesFeZ+7H0uXDoC4LNltef5buuKeO2THyq0VBg/A="; 53 52 }; 54 53 picos = ocamlPackages.buildDunePackage { 55 54 pname = "picos"; ··· 70 69 src = picos_src; 71 70 buildInputs = with ocamlPackages; [ 72 71 picos 72 + picos_aux 73 73 backoff 74 74 thread-local-storage 75 75 multicore-magic
+23 -10
jj_tui/bin/jj_process.ml
··· 1 1 open Picos_std_structured 2 2 open Picos_std_sync 3 3 open Picos_std_finally 4 - open Spawn 5 4 open Jj_tui.Logging 6 5 7 6 module type t = sig ··· 115 114 in 116 115 (* This should ensure that all children processes are killed before we cleanup the pipes*) 117 116 Flock.join_after @@ fun () -> 118 - let pid = 119 - Picos_io.Unix.create_process_env 120 - cmd 121 - (cmd :: args |> Array.of_list) 122 - (Unix.environment ()) 123 - stdin_o 124 - stdout_i 125 - stderr_i 117 + let isDone = ref false in 118 + let@ pid = 119 + finally 120 + (fun pid -> 121 + (* if the process didn't finish we will kill the process and then wait it's pid to release the pid*) 122 + if not !isDone 123 + then ( 124 + try 125 + Unix.kill pid Sys.sigkill; 126 + Unix.waitpid [ Unix.WUNTRACED ] pid |> ignore 127 + with 128 + | _ -> 129 + ())) 130 + (fun _ -> 131 + Unix.create_process_env 132 + cmd 133 + (cmd :: args |> Array.of_list) 134 + (Unix.environment ()) 135 + stdin_o 136 + stdout_i 137 + stderr_i) 126 138 in 127 - let prom = Flock.fork_as_promise (fun () -> Picos_io.Unix.waitpid [] pid) in 139 + let prom = Flock.fork_as_promise (fun () -> Unix.waitpid [] pid) in 128 140 (* Close unused pipe ends in the parent process *) 129 141 Unix.close stdout_i; 130 142 Unix.close stdin_o; ··· 136 148 let stdout = Promise.await stdout_prom in 137 149 let stderr = Promise.await stderr_prom in 138 150 let code, status = Promise.await prom in 151 + isDone := true; 139 152 (* let stderr = read_fd_to_end stderr_i in *) 140 153 (* let stdout= ""in *) 141 154 code, status, stdout, stderr
+2 -1
jj_tui/lib/logging.ml
··· 95 95 match Sys.os_type with 96 96 | "Unix" -> 97 97 (try 98 - let uname_in, _ = Unix.open_process_args "uname" [| "uname"; "-s" |] in 98 + let uname_in = Unix.open_process_args_in "uname" [| "uname"; "-s" |] in 99 99 let str = uname_in |> In_channel.input_all in 100 + Unix.wait()|>ignore; 100 101 Some (str |> String.lowercase_ascii |> String.trim) 101 102 with 102 103 | _ ->