2017-09-07 15:27:35 +02:00
|
|
|
import { exec } from 'child_process'
|
|
|
|
|
2017-12-28 13:59:22 +01:00
|
|
|
import { ServerInfo } from '../server/servers'
|
2017-09-07 15:27:35 +02:00
|
|
|
|
|
|
|
function getEnvCli (server?: ServerInfo) {
|
2020-07-30 15:34:00 +02:00
|
|
|
return `NODE_ENV=test NODE_APP_INSTANCE=${server.internalServerNumber}`
|
2017-09-07 15:27:35 +02:00
|
|
|
}
|
|
|
|
|
2020-01-10 10:30:08 +01:00
|
|
|
async function execCLI (command: string) {
|
2017-09-07 17:58:09 +02:00
|
|
|
return new Promise<string>((res, rej) => {
|
2017-09-07 15:27:35 +02:00
|
|
|
exec(command, (err, stdout, stderr) => {
|
|
|
|
if (err) return rej(err)
|
|
|
|
|
|
|
|
return res(stdout)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
export {
|
|
|
|
execCLI,
|
|
|
|
getEnvCli
|
|
|
|
}
|