123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140openBosmoduleArg=Cmdliner.ArgmoduleTerm=Cmdliner.TermmoduleContext=Types.ContextmoduleForward_progress=Forward_progressmoduletypeComponent_config=Dkml_install_api_intf.Component_configmoduletypeComponent_config_defaultable=Dkml_install_api_intf.Component_config_defaultableletadministrator=ifSys.win32then"Administrator privileges"else"root permissions"moduleDefault_component_config=structletdepends_on=[]letdo_nothing_with_ctx_t_ctx=()letsdocs=Cmdliner.Manpage.s_common_optionsletinstall_user_subcommand~component_name~subcommand_name~fl~ctx_t=letdoc=Fmt.str"Currently does nothing. Would install the component '%s' except the \
parts, if any, that need %s"component_nameadministratorinletcmd=Term.(constdo_nothing_with_ctx_t$ctx_t,infosubcommand_name~sdocs~doc)inForward_progress.return(cmd,fl)letuninstall_user_subcommand~component_name~subcommand_name~fl~ctx_t=letdoc=Fmt.str"Currently does nothing. Would uninstall the component '%s' except the \
parts, if any, that need %s"component_nameadministratorinletcmd=Term.(constdo_nothing_with_ctx_t$ctx_t,infosubcommand_name~sdocs~doc)inForward_progress.return(cmd,fl)letneeds_install_admin~ctx:(_:Context.t)=falseletneeds_uninstall_admin~ctx:(_:Context.t)=falseletinstall_admin_subcommand~component_name~subcommand_name~fl~ctx_t=letdoc=Fmt.str"Currently does nothing. Would install the parts of the component '%s' \
that need %s"component_nameadministratorinletcmd=Term.(constdo_nothing_with_ctx_t$ctx_t,infosubcommand_name~sdocs~doc)inForward_progress.return(cmd,fl)letuninstall_admin_subcommand~component_name~subcommand_name~fl~ctx_t=letdoc=Fmt.str"Currently does nothing. Would uninstall the parts of the component \
'%s' that need %s"component_nameadministratorinletcmd=Term.(constdo_nothing_with_ctx_t$ctx_t,infosubcommand_name~sdocs~doc)inForward_progress.return(cmd,fl)lettest()=()endmoduleLog_config=structincludeLog_configendletlog_spawn_onerror_exit~id?conformant_subprocess_exitcodescmd=Logs.info(funm->m"Running command: %a"Cmd.ppcmd);letfl=Forward_progress.stderr_fatalloginletopenAstringinletsequence=let(let*)=Result.bindinlet*env=OS.Env.current()inletnew_env=letis_not_defined=matchString.Map.find"OCAMLRUNPARAM"envwith|None->true|Some""->true|Some_->falseinifis_not_definedthenString.Map.add"OCAMLRUNPARAM""b"envelseenvinOS.Cmd.run_status~env:new_envcmdinmatchsequencewith|Ok(`Exited0)->Logs.info(funm->m"%a ran successfully"Fmt.(optionstring)(Cmd.line_toolcmd));()|Ok(`Exitedspawned_exitcode)->letadjective,exitcode=ifconformant_subprocess_exitcodes=Somefalsethen("",Forward_progress.Exit_code.Exit_transient_failure)else("conformant ",List.fold_left(funaccec->ifspawned_exitcode=Forward_progress.Exit_code.to_int_exitcodeecthenecelseacc)Forward_progress.Exit_code.Exit_transient_failureForward_progress.Exit_code.values)infl~id(Fmt.str"%s\n\n\
Root cause: @[The %scommand had exit code %d:@ %a@]\n\n\
>>> %s <<<"(Forward_progress.Exit_code.to_short_sentenceexitcode)adjectivespawned_exitcodeCmd.ppcmd(Forward_progress.Exit_code.to_short_sentenceexitcode));exit(Forward_progress.Exit_code.to_int_exitcodeexitcode)|Ok(`Signaledc)->fl~id(Fmt.str"The command@ %a@ terminated from a signal %d"Cmd.ppcmdc);exit(Forward_progress.Exit_code.to_int_exitcodeExit_transient_failure)|Errorrmsg->fl~id(Fmt.str"The command@ %a@ could not be run due to: %a"Cmd.ppcmdRresult.R.pp_msgrmsg);exit(Forward_progress.Exit_code.to_int_exitcodeExit_transient_failure)