]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - shared/extra-utils/cli/cli.ts
Introduce bulk command
[github/Chocobozzz/PeerTube.git] / shared / extra-utils / cli / cli.ts
CommitLineData
fdbda9e3
C
1import { exec } from 'child_process'
2
c5d31dba 3import { ServerInfo } from '../server/servers'
fdbda9e3
C
4
5function getEnvCli (server?: ServerInfo) {
f4659d73 6 return `NODE_ENV=test NODE_APP_INSTANCE=${server.internalServerNumber}`
fdbda9e3
C
7}
8
62fca05d 9async function execCLI (command: string) {
8df87ce7 10 return new Promise<string>((res, rej) => {
fdbda9e3
C
11 exec(command, (err, stdout, stderr) => {
12 if (err) return rej(err)
13
14 return res(stdout)
15 })
16 })
17}
18
19// ---------------------------------------------------------------------------
20
21export {
22 execCLI,
23 getEnvCli
24}