Add unique ids to each Hack build, and handle sigint
[hiphop-php.git] / hphp / hack / src / utils / exit_status.ml
blob49d5abc6e5da66a5b0420f0c56eb9b2c99c1b84b
1 (**
2 * Copyright (c) 2015, Facebook, Inc.
3 * All rights reserved.
5 * This source code is licensed under the BSD-style license found in the
6 * LICENSE file in the "hack" directory of this source tree. An additional grant
7 * of patent rights can be found in the PATENTS file in the same directory.
9 *)
11 type t =
12 | Ok
13 | Build_error
14 | Build_terminated
15 | Checkpoint_error
16 | Input_error
17 | Kill_error
18 | No_server_running
19 | Out_of_time
20 | Out_of_retries
21 | Server_already_exists
22 | Server_initializing
23 | Type_error
24 | Build_id_mismatch
25 | Unused_server
26 | Lock_stolen
27 | Interrupted
29 exception Exit_with of t
31 let exit t =
32 let ec = match t with
33 | Ok -> 0
34 | Build_error -> 2
35 | Build_terminated -> 1
36 | Checkpoint_error -> 8
37 | Input_error -> 10
38 | Kill_error -> 1
39 | No_server_running -> 6
40 | Out_of_time -> 7
41 | Out_of_retries -> 7
42 | Server_already_exists -> 77
43 | Server_initializing -> 1
44 | Type_error -> 2
45 | Build_id_mismatch -> 9
46 | Unused_server -> 5
47 | Lock_stolen -> 11
48 | Interrupted -> -6
50 Pervasives.exit ec
52 let to_string = function
53 | Ok -> "Ok"
54 | Build_error -> "Build_error"
55 | Build_terminated -> "Build_terminated"
56 | Checkpoint_error -> "Checkpoint_error"
57 | Input_error -> "Input_error"
58 | Kill_error -> "Kill_error"
59 | No_server_running -> "No_server_running"
60 | Out_of_time -> "Out_of_time"
61 | Out_of_retries -> "Out_of_retries"
62 | Server_already_exists -> "Server_already_exists"
63 | Server_initializing -> "Server_initializing"
64 | Type_error -> "Type_error"
65 | Build_id_mismatch -> "Build_id_mismatch"
66 | Unused_server -> "Unused_server"
67 | Lock_stolen -> "Lock_stolen"
68 | Interrupted -> "Interrupted"