12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2021 Nomadic Labs. <contact@nomadic-labs.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)letparse_args()=letsocket_dir=refNoneinletargs=Arg.[("--socket-dir",String(funs->ifnot(Sys.file_existss&&Sys.is_directorys)thenraise(Arg.Bad(Format.sprintf"File '%s' is not a valid directory"s))elsesocket_dir:=Somes),{|<dir>
When provided, the validator will communicate through a socket located
at '<dir>/tezos-validation-socket-<pid>' where <pid> is the
tezos-validator's process identifier. By default, the validator will
communicate through its standard input and output.|});("--version",Unit(fun()->Format.printf"%s\n"Tezos_version_value.Bin_version.octez_version_string;Stdlib.exit0)," Display version information");]inletusage_msg=Format.sprintf"tezos-validator [--version] [--socket-dir <dir>]"inArg.parseargs(funs->raise(Arg.Bad(Format.sprintf"Unexpected argument: %s"s)))usage_msg;!socket_dirletrun()=letsocket_dir=parse_args()inletmain_promise=External_validator.main?socket_dir()inStdlib.exit(letopenLwt_syntaxinLwt.Exception_filter.(sethandle_all_except_runtime);Lwt_main.run(let*r=Lwt_exit.wrap_and_exitmain_promiseinmatchrwith|Ok()->Lwt_exit.exit_and_wait0|Errorerr->Format.eprintf"%a\n%!"pp_print_traceerr;Lwt_exit.exit_and_wait1))