forked from ocaml/opam
/
Run.html
163 lines (162 loc) · 11.9 KB
/
Run.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<link rel="Start" href="index.html">
<link rel="previous" href="Repositories.html">
<link rel="next" href="Solver.html">
<link rel="Up" href="index.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Index of module types" rel=Appendix href="index_module_types.html">
<link title="Client" rel="Chapter" href="Client.html">
<link title="File" rel="Chapter" href="File.html">
<link title="File_format" rel="Chapter" href="File_format.html">
<link title="Parallel" rel="Chapter" href="Parallel.html">
<link title="Path" rel="Chapter" href="Path.html">
<link title="Process" rel="Chapter" href="Process.html">
<link title="Repositories" rel="Chapter" href="Repositories.html">
<link title="Run" rel="Chapter" href="Run.html">
<link title="Solver" rel="Chapter" href="Solver.html">
<link title="Types" rel="Chapter" href="Types.html"><link title="File locking function" rel="Section" href="#2_Filelockingfunction">
<link title="Function used only by the switch commnand" rel="Section" href="#2_Functionusedonlybytheswitchcommnand">
<title>Run</title>
</head>
<body>
<div class="navbar"><a class="pre" href="Repositories.html" title="Repositories">Previous</a>
<a class="up" href="index.html" title="Index">Up</a>
<a class="post" href="Solver.html" title="Solver">Next</a>
</div>
<h1>Module <a href="type_Run.html">Run</a></h1>
<pre><span class="keyword">module</span> Run: <code class="code">sig</code> <a href="Run.html">..</a> <code class="code">end</code></pre>Low-level untyped system operations.<br>
<hr width="100%">
<pre><span id="EXCEPTIONProcess_error"><span class="keyword">exception</span> Process_error</span> <span class="keyword">of</span> <code class="type"><a href="Process.html#TYPEresult">Process.result</a></code></pre>
<div class="info">
Exception raised when subprocess fails<br>
</div>
<pre><span id="VALprocess_error"><span class="keyword">val</span> process_error</span> : <code class="type"><a href="Process.html#TYPEresult">Process.result</a> -> 'a</code></pre><div class="info">
raise <code class="code">Process_error</code><br>
</div>
<pre><span id="EXCEPTIONInternal_error"><span class="keyword">exception</span> Internal_error</span> <span class="keyword">of</span> <code class="type">string</code></pre>
<div class="info">
Exception raised when a computation in the current process
fails.<br>
</div>
<pre><span id="VALinternal_error"><span class="keyword">val</span> internal_error</span> : <code class="type">('a, unit, string, 'b) Pervasives.format4 -> 'a</code></pre><div class="info">
Raise <code class="code">Internal_error</code><br>
</div>
<pre><span id="VALwith_tmp_dir"><span class="keyword">val</span> with_tmp_dir</span> : <code class="type">(string -> 'a) -> 'a</code></pre><div class="info">
<code class="code">with_tmp_dir fn</code> executes <code class="code">fn</code> in a tempory directory<br>
</div>
<pre><span id="VALcopy"><span class="keyword">val</span> copy</span> : <code class="type">string -> string -> unit</code></pre><div class="info">
<code class="code">copy src dst</code> copies <code class="code">src</code> to <code class="code">dst</code>. Remove <code class="code">dst</code> before the copy if it is a link.<br>
</div>
<pre><span id="VALlink"><span class="keyword">val</span> link</span> : <code class="type">string -> string -> unit</code></pre><div class="info">
<code class="code">link src dst</code> links <code class="code">src</code> to <code class="code">dst</code>. Remove <code class="code">dst</code> if it is a file, not a directory.<br>
</div>
<pre><span id="VALreal_path"><span class="keyword">val</span> real_path</span> : <code class="type">string -> string</code></pre><div class="info">
<code class="code">real_path p</code> returns the real path associated to <code class="code">p</code>: <code class="code">..</code> are
expanded and relative paths become absolute.<br>
</div>
<pre><span id="VALread"><span class="keyword">val</span> read</span> : <code class="type">string -> string</code></pre><div class="info">
<code class="code">read filename</code> returns the contents of <code class="code">filename</code><br>
</div>
<pre><span id="VALwrite"><span class="keyword">val</span> write</span> : <code class="type">string -> string -> unit</code></pre><div class="info">
<code class="code">write filename contents</code> write <code class="code">contents</code> to <code class="code">filename</code><br>
</div>
<pre><span id="VALremove"><span class="keyword">val</span> remove</span> : <code class="type">string -> unit</code></pre><div class="info">
<code class="code">remove filename</code> removes <code class="code">filename</code>. Works whether <code class="code">filename</code> is
a file or a directory<br>
</div>
<pre><span id="VALremove_file"><span class="keyword">val</span> remove_file</span> : <code class="type">string -> unit</code></pre><div class="info">
<code class="code">remove_file filename</code> removes <code class="code">filename</code>. Works only for normal
files (or also at least for symlinks)<br>
</div>
<pre><span id="VALremove_dir"><span class="keyword">val</span> remove_dir</span> : <code class="type">string -> unit</code></pre><div class="info">
<code class="code">remove_dir filename</code> removes <code class="code">filename</code>. Works only for
directory (not for symlinks or other files).<br>
</div>
<pre><span id="VALchdir"><span class="keyword">val</span> chdir</span> : <code class="type">string -> unit</code></pre><div class="info">
Change the current working directory<br>
</div>
<pre><span id="VALin_dir"><span class="keyword">val</span> in_dir</span> : <code class="type">string -> (unit -> 'a) -> 'a</code></pre><div class="info">
<code class="code">in_dir dir fn</code> evaluates <code class="code">fn</code> in the directory <code class="code">dir</code><br>
</div>
<pre><span id="VALfiles_with_links"><span class="keyword">val</span> files_with_links</span> : <code class="type">string -> string list</code></pre><div class="info">
<code class="code">files_with_links dir</code> returns the files in the directory <code class="code">dir</code>.
Links simulating directory are ignored, others links are returned.<br>
</div>
<pre><span id="VALrec_files"><span class="keyword">val</span> rec_files</span> : <code class="type">string -> string list</code></pre><div class="info">
<code class="code">rec_files dir</code> returns the list of all files in <code class="code">dir</code>,
recursively.
Links behaving like directory are crossed.<br>
</div>
<pre><span id="VALocaml_version"><span class="keyword">val</span> ocaml_version</span> : <code class="type">unit -> string option</code></pre><div class="info">
Return the version of the current OCaml compiler. If no OCaml
compiler is present in the path, then it returns <code class="code">None</code>.<br>
</div>
<pre><span id="VALocamlc_where"><span class="keyword">val</span> ocamlc_where</span> : <code class="type">unit -> string option</code></pre><div class="info">
Return the path where ocamlc library is installed<br>
</div>
<pre><span id="VALdirectories_with_links"><span class="keyword">val</span> directories_with_links</span> : <code class="type">string -> string list</code></pre><div class="info">
<code class="code">directories_with_links dir</code> returns the directories in the directory <code class="code">dir</code>.
Links pointing to directory are also returned.<br>
</div>
<pre><span id="TYPEcommand"><span class="keyword">type</span> <code class="type"></code>command</span> = <code class="type">string list</code> </pre>
<div class="info">
a command is a list of words<br>
</div>
<pre><span id="VALcommand"><span class="keyword">val</span> command</span> : <code class="type">?verbose:bool -><br> ?add_to_env:(string * string) list -><br> ?add_to_path:string list -> <a href="Run.html#TYPEcommand">command</a> -> unit</code></pre><div class="info">
<code class="code">command cmd</code> executes the command <code class="code">cmd</code>. Return the exit code.<br>
</div>
<pre><span id="VALcommands"><span class="keyword">val</span> commands</span> : <code class="type">?verbose:bool -><br> ?add_to_env:(string * string) list -><br> ?add_to_path:string list -> <a href="Run.html#TYPEcommand">command</a> list -> unit</code></pre><div class="info">
<code class="code">commands ~add_to_path cmds</code> executes the commands <code class="code">cmds</code>
in a context where $PATH contains <code class="code">add_to_path</code> at the beginning.
It stops whenever one command fails.<br>
</div>
<pre><span id="VALread_command_output"><span class="keyword">val</span> read_command_output</span> : <code class="type">?add_to_env:(string * string) list -><br> ?add_to_path:string list -> <a href="Run.html#TYPEcommand">command</a> -> string list</code></pre><div class="info">
<code class="code">read_command_output cmd</code> executes the command <code class="code">cmd</code> and return
the lines from stdout<br>
</div>
<pre><span id="VALis_tar_archive"><span class="keyword">val</span> is_tar_archive</span> : <code class="type">string -> bool</code></pre><div class="info">
Test whether the file is an archive, by looking as its extension<br>
</div>
<pre><span id="VALextract"><span class="keyword">val</span> extract</span> : <code class="type">string -> string -> unit</code></pre><div class="info">
<code class="code">extract filename dirname</code> extracts the archive <code class="code">filename</code> into
<code class="code">dirname</code>. <code class="code">dirname</code> should not exists and <code class="code">filename</code> should
contain only one top-level directory.<br>
</div>
<pre><span id="VALextract_in"><span class="keyword">val</span> extract_in</span> : <code class="type">string -> string -> unit</code></pre><div class="info">
<code class="code">extract_in filename dirname</code> extracts the archive <code class="code">filename</code> into
<code class="code">dirname</code>. <code class="code">dirname</code> should already exists.<br>
</div>
<pre><span id="VALmkdir"><span class="keyword">val</span> mkdir</span> : <code class="type">string -> unit</code></pre><div class="info">
Create a directory. Do not fail if the directory already
exist.<br>
</div>
<br>
<span id="2_Filelockingfunction"><h2>File locking function</h2></span><br>
<pre><span id="VALflock"><span class="keyword">val</span> flock</span> : <code class="type">unit -> unit</code></pre><div class="info">
<code class="code">flock ()</code> takes the global file lock. If the lock is already
taken, sleep for 1s and then retry. Abort after 5 tentatives.<br>
</div>
<pre><span id="VALfunlock"><span class="keyword">val</span> funlock</span> : <code class="type">unit -> unit</code></pre><div class="info">
<code class="code">funlock ()</code> unlocks the global file lock. Work only if the
current processus is the same as the one who took the lock at the
first place.<br>
</div>
<pre><span id="VALwith_flock"><span class="keyword">val</span> with_flock</span> : <code class="type">(unit -> unit) -> unit</code></pre><div class="info">
Functional version of <code class="code">flock / funlock</code><br>
</div>
<br>
<span id="2_Functionusedonlybytheswitchcommnand"><h2>Function used only by the switch commnand</h2></span><br>
<pre><span id="VALdownload"><span class="keyword">val</span> download</span> : <code class="type">filename:string -> dirname:string -> string</code></pre><div class="info">
download compiler sources<br>
</div>
<pre><span id="VALpatch"><span class="keyword">val</span> patch</span> : <code class="type">string -> unit</code></pre><div class="info">
Apply a patch file in the current directory.<br>
</div>
</body></html>