-
Notifications
You must be signed in to change notification settings - Fork 208
/
utils.js
39 lines (35 loc) · 1.07 KB
/
utils.js
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
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
function logBuildWarning(msg) {
if (process.env.TF_BUILD)
console.error("##vso[task.logissue type=warning;]%s", msg);
else
console.error("WARNING: %s", msg);
}
function logBuildError(msg) {
if (process.env.TF_BUILD)
console.error("##vso[task.logissue type=error;]%s", msg);
else
console.error("ERROR: %s", msg);
}
function failBuild() {
if (process.env.TF_BUILD) {
console.error("##vso[task.complete result=Failed;]DONE")
process.exit(0);
} else {
process.exit(1);
}
}
function throwAfterTimeout(timeout, message) {
return new Promise((_resolve, reject) => {
setTimeout(() => reject(message), timeout);
});
}
module.exports = {
logBuildWarning,
logBuildError,
failBuild,
throwAfterTimeout
}