1 import { exec } from 'child_process'
2 import { AbstractCommand } from '../shared'
4 export class CLICommand extends AbstractCommand {
6 static exec (command: string) {
7 return new Promise<string>((res, rej) => {
8 exec(command, (err, stdout, _stderr) => {
9 if (err) return rej(err)
17 return `NODE_ENV=test NODE_APP_INSTANCE=${this.server.internalServerNumber}`
20 async execWithEnv (command: string, configOverride?: any) {
21 const prefix = configOverride
22 ? `NODE_CONFIG='${JSON.stringify(configOverride)}'`
25 return CLICommand.exec(`${prefix} ${this.getEnv()} ${command}`)