-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
21 lines (20 loc) · 698 Bytes
/
Copy pathindex.js
File metadata and controls
21 lines (20 loc) · 698 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const { exec } = require('child_process');
const { getReqObj } = require('../../commonMethods');
module.exports = function forTC(OPTS, test, fileData, done, noti) {
const { reqObj, callback } = getReqObj(this, OPTS, test, fileData, done, noti);
noti('SYS_COMMAND', reqObj);
let payl = reqObj.payload;
if (reqObj.prefix) {
payl = `${reqObj.prefix} '${reqObj.payload.split("'").join("\\'")}'`;
}
exec(payl, reqObj.options, function(er, sto, ste) {
if (typeof reqObj.parser === 'function') {
try { sto = reqObj.parser(sto); } catch(er) { }
try { ste = reqObj.parser(ste); } catch(er) { }
}
callback(er, {
output : sto,
error : ste
});
});
};