aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yt/system/exit.cpp
blob: e4088fe4da206337632cda0e6b06c2012b83f86b (plain) (blame)
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
#include "exit.h"

namespace NYT {

////////////////////////////////////////////////////////////////////////////////

void AbortProcessSilently(int exitCode)
{
    _exit(exitCode);
}

void AbortProcessDramatically(int exitCode, TStringBuf exitCodeStr, TStringBuf message)
{
    fprintf(stderr, "\n");
    if (message) {
        fprintf(stderr, "*** %s\n", message.data());
    }
    fprintf(stderr, "*** Aborting process with exit code %d", exitCode);
    if (exitCodeStr) {
        fprintf(stderr, " (%s)", exitCodeStr.data());
    }
    fprintf(stderr, "\n");
    _exit(exitCode);
}

////////////////////////////////////////////////////////////////////////////////

} // namespace NYT