-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
41 lines (33 loc) · 981 Bytes
/
index.js
File metadata and controls
41 lines (33 loc) · 981 Bytes
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
'use strict';
const ms = require('ms');
const Executor = require('@runnerty/module-core').Executor;
class waitExecutor extends Executor {
constructor(process) {
super(process);
}
async exec(params) {
const endOptions = { end: 'end' };
// Backward compatibility with version 1:
if (params.seconds && !params.time) {
params.time = params.seconds + 's';
}
// 60s default value:
if (!params.seconds && !params.time) {
params.time = '60 s';
}
if (params.output && params.output != '') {
endOptions.messageLog = params.output;
endOptions.data_output = params.output;
endOptions.msg_output = params.output;
}
if (params.error && params.error != '') {
endOptions.end = 'error';
endOptions.messageLog = params.error;
endOptions.err_output = params.error;
}
setTimeout(() => {
this.end(endOptions);
}, ms('' + params.time) || 0);
}
}
module.exports = waitExecutor;