mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2024-11-28 11:34:01 -06:00
25 lines
525 B
TypeScript
25 lines
525 B
TypeScript
import { exec } from 'child_process'
|
|
|
|
import { ServerInfo } from '../server/servers'
|
|
|
|
function getEnvCli (server?: ServerInfo) {
|
|
return `NODE_ENV=test NODE_APP_INSTANCE=${server.internalServerNumber}`
|
|
}
|
|
|
|
async function execCLI (command: string) {
|
|
return new Promise<string>((res, rej) => {
|
|
exec(command, (err, stdout, stderr) => {
|
|
if (err) return rej(err)
|
|
|
|
return res(stdout)
|
|
})
|
|
})
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
export {
|
|
execCLI,
|
|
getEnvCli
|
|
}
|