mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 10:19:35 +02:00
Rename command files
This commit is contained in:
parent
c1bc8ee478
commit
f59545d97a
10 changed files with 9 additions and 9 deletions
23
shared/extra-utils/cli/cli-command.ts
Normal file
23
shared/extra-utils/cli/cli-command.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
import { exec } from 'child_process'
|
||||
import { AbstractCommand } from '../shared'
|
||||
|
||||
export class CLICommand extends AbstractCommand {
|
||||
|
||||
static exec (command: string) {
|
||||
return new Promise<string>((res, rej) => {
|
||||
exec(command, (err, stdout, _stderr) => {
|
||||
if (err) return rej(err)
|
||||
|
||||
return res(stdout)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
getEnv () {
|
||||
return `NODE_ENV=test NODE_APP_INSTANCE=${this.server.internalServerNumber}`
|
||||
}
|
||||
|
||||
async execWithEnv (command: string) {
|
||||
return CLICommand.exec(`${this.getEnv()} ${command}`)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue