1
0
Fork 0
peertube/shared/utils/cli/cli.ts
buoyantair 9639bd1757 Move utils to /shared
Move utils used by /server/tools/* & /server/tests/**/* into
/shared folder.

Issue: #1336
2018-10-29 22:18:31 +05:30

24 lines
517 B
TypeScript

import { exec } from 'child_process'
import { ServerInfo } from '../server/servers'
function getEnvCli (server?: ServerInfo) {
return `NODE_ENV=test NODE_APP_INSTANCE=${server.serverNumber}`
}
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
}