Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file forward_progress.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110moduleExit_code=structtypet=|Exit_transient_failure|Exit_unrecoverable_failure|Exit_restart_needed|Exit_reboot_needed|Exit_upgrade_requiredletshow=function|Exit_transient_failure->"Exit_transient_failure"|Exit_unrecoverable_failure->"Exit_unrecoverable_failure"|Exit_restart_needed->"Exit_restart_needed"|Exit_reboot_needed->"Exit_reboot_needed"|Exit_upgrade_required->"Exit_upgrade_required"letppfmtv=Fmt.pffmt"%s"(showv)letvalues=[Exit_transient_failure;Exit_unrecoverable_failure;Exit_restart_needed;Exit_reboot_needed;Exit_upgrade_required;]letto_int_exitcode=function|Exit_transient_failure->20|Exit_unrecoverable_failure->21|Exit_restart_needed->22|Exit_reboot_needed->23|Exit_upgrade_required->24letto_short_sentence=function|Exit_transient_failure->"A transient failure occurred."|Exit_unrecoverable_failure->"An unrecoverable failure occurred."|Exit_restart_needed->"The process needs to be restarted."|Exit_reboot_needed->"The machine needs rebooting."|Exit_upgrade_required->"An upgrade needs to happen."endtypefatal_logger=id:string->string->unittype'at=|Continue_progressof'a*fatal_logger|Halted_progressofExit_code.t|Completedletreturn(a,fl)=Continue_progress(a,fl)letstyled_fatal_id=letpp1=Fmt.styled(`Fg`Red)(funfmt->Fmt.pffmt"FATAL [%s].")inletpp2=Fmt.styled`Boldpp1inFmt.styled`Underlinepp2letstyled_fatal_message=letpp1=Fmt.styled(`Fg`Red)(funfmt->Fmt.pffmt"%a@."Fmt.lines)inFmt.styled`Boldpp1letstderr_fatallog~ids=ifs=""thenFmt.epr"%a@."styled_fatal_ididelseFmt.epr"%a %a@."styled_fatal_ididstyled_fatal_messagesletstderr()=Continue_progress((),stderr_fatallog)letbindfwdf=matchfwdwith|Continue_progress(u,fl)->f(u,fl)|Halted_progressexitcode->Halted_progressexitcode|Completed->Completedletmapffwd=matchfwdwith|Continue_progress(u,fl)->Continue_progress(fu,fl)|Halted_progressexitcode->Halted_progressexitcode|Completed->Completedletcatch_exceptions~idflf=(* Sister function is Error_handling.catch_and_exit_on_error *)tryfflwithe->letmsg=Printexc.to_stringeandstack=Printexc.get_backtrace()infl~id(Fmt.str"@[%a@]@,@[%a@]"Fmt.linesmsgFmt.linesstack);Halted_progressExit_unrecoverable_failureletpos_to_id(file,lnum,_cnum,_enum)=letbasename=Filename.basenamefilein(* The order matters for the pre-hash. Put parts
of the identification that will not have a separator (comma)
before the filename which could conceivably include
a separator. *)letprehash=Fmt.str"%d,%s"lnumbasenamein(* Digest is MD5 hash *)lethash=Digest.(stringprehash|>to_hex|>String.lowercase_ascii)inString.subhash08letlift_resultposefmtfl=function|Okv->return(v,fl)|Errore->fl~id:(pos_to_idpos)(Fmt.str"%a"efmte);Halted_progressExit_transient_failureletiter~flf=List.fold_left(funaccv->matchaccwith|Continue_progress((),_fl)->fv|Halted_progressu->Halted_progressu|Completed->Completed)(Continue_progress((),fl))