package opam-core
Install
Dune Dependency
Authors
-
David Allsopp
-
VVincent Bernardoff <vb@luminar.eu.org>
-
RRaja Boujbel <raja.boujbel@ocamlpro.com>
-
KKate Deplaix <kit-ty-kate@outlook.com>
-
RRoberto Di Cosmo <roberto@dicosmo.org>
-
TThomas Gazagnaire <thomas@gazagnaire.org>
-
LLouis Gesbert <louis.gesbert@ocamlpro.com>
-
FFabrice Le Fessant <Fabrice.Le_fessant@inria.fr>
-
AAnil Madhavapeddy <anil@recoil.org>
-
GGuillem Rieu <guillem.rieu@ocamlpro.com>
-
RRalf Treinen <ralf.treinen@pps.jussieu.fr>
-
FFrederic Tuong <tuong@users.gforge.inria.fr>
Maintainers
Sources
md5=c74015d93dffc824bc339dabed86027b
sha512=122dd2624106cd7bdb4d835d08aabeb3feee18a42b537e0e5c0da1e56cb4e908705e77e8720aa652a2e0b588aa9ba1cd53bb3e952f3243d9025cae7c753b0576
doc/opam-core/OpamStd/Sys/index.html
Module OpamStd.Sys
Source
Querying
true if stdout is bound to a terminal
true if stdin is bound to a terminal
Queried lazily, but may change on SIGWINCH
The user's home directory. Queried lazily
The /etc directory
The system directory (Windows only)
The output of the command "uname", with the given argument. Memoised.
Append .exe (only if missing) to executable filenames on Windows
Remove .exe (if present) from an executable filename on Windows
The different families of shells we know about
Guess the location of .profile. Returns None if the shell doesn't support the concept of a .profile file.
The separator character used in the PATH variable (varies depending on OS)
true
if a character may be used in a filename, depending on the OS. For example, on Windows, `:` and `?` can't be in the name.
Splits a PATH-like variable separated with path_sep
. More involved than it seems, because there may be quoting on Windows. By default, it returns the path cleaned (remove trailing, leading, contiguous delimiters). Optional argument clean
permits to keep those empty strings.
val resolve_command :
?env:string array ->
?dir:string ->
string ->
[ `Cmd of string | `Denied | `Not_found ]
Test whether a command exists in the environment, and returns it (resolved if found in PATH). ~env
defaults to Env.raw_env
.
Search for an arbitrary file in PATH. Unlike resolve_command
, no transformations take place on the name in Windows (i.e. .exe, etc. is never appended) and no executable check takes place. The name passed must be a basename (no directory component).
val get_windows_executable_variant :
?search_in_first:string ->
string ->
[ `Native | `Cygwin | `Tainted of [ `Msys2 | `Cygwin ] | `Msys2 ]
For native Windows builds, returns `Cygwin
if the command is a Cygwin- compiled executable, `Msys2
if the command is a MSYS2-compiled executable, and `Tainted of [ `Msys2 | `Cygwin ]
if the command links to a library which is itself Cygwin- or MSYS2-compiled, or `Native
otherwise.
If supplied, ~search_in_first
specifies a directory which should be searched for cygcheck prior to searching the current PATH.
If the command given is not an absolute path, it too is resolved in the current PATH.
If cygcheck cannot be resolved in PATH, or when running the Cygwin build of opam, the function returns `Native.
val get_cygwin_variant :
?search_in_first:string ->
string ->
[ `Native | `Cygwin | `CygLinked ]
Behaviour is largely as get_windows_executable_variant
but where MSYS2 and Cygwin are seen as equivalent.
For native Windows builds, returns `Cygwin
if the command is a Cygwin- or Msys2- compiled executable, and `CygLinked
if the command links to a library which is itself Cygwin/Msys2-compiled, or `Native
otherwise.
Returns true if get_cygwin_variant
is `Cygwin
Exit handling
Like Stdlib.at_exit but with the possibility to call manually (eg. before exec())
Calls the functions registered in at_exit. Unneeded if exiting normally
Indicates intention to exit the program with given exit code
Indicates intention to exec() the given command (parameters as per Unix.execvpe
), after proper finalisations. It's the responsibility of the main function to catch this, call exec_at_exit
, and Unix.execvpe
.
Raises Exit i
type exit_reason = [
| `Success
| `False
| `Bad_arguments
| `Not_found
| `Aborted
| `Locked
| `No_solution
| `File_error
| `Package_operation_error
| `Sync_error
| `Configuration_error
| `Solver_failure
| `Internal_error
| `User_interrupt
]
Raises Exit
, with the code associated to the exit reason