1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 18:29:27 +02:00

Move utils to /shared

Move utils used by /server/tools/* & /server/tests/**/* into
/shared folder.

Issue: #1336
This commit is contained in:
buoyantair 2018-10-29 22:18:31 +05:30
parent 71607e4a65
commit 9639bd1757
104 changed files with 318 additions and 196 deletions

24
shared/utils/cli/cli.ts Normal file
View file

@ -0,0 +1,24 @@
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
}