1structure SHA1_ML :> SHA1_ML = 2struct 3 4 fun sha1_file {filename} = 5 if OS.FileSys.access("/usr/bin/shasum", [OS.FileSys.A_EXEC]) then 6 case Mosml.run "/usr/bin/shasum" [Systeml.protect filename] "" of 7 Mosml.Success s => hd (String.tokens Char.isSpace s) 8 | Mosml.Failure _ => raise Fail ("Calling shasum {filename=\"" ^ filename ^ "} failed") 9 else 10 raise Fail "shasum not installed" 11 12end (* struct *) 13