aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/cli/cli-command.ts
diff options
context:
space:
mode:
Diffstat (limited to 'shared/extra-utils/cli/cli-command.ts')
-rw-r--r--shared/extra-utils/cli/cli-command.ts27
1 files changed, 0 insertions, 27 deletions
diff --git a/shared/extra-utils/cli/cli-command.ts b/shared/extra-utils/cli/cli-command.ts
deleted file mode 100644
index ab9738174..000000000
--- a/shared/extra-utils/cli/cli-command.ts
+++ /dev/null
@@ -1,27 +0,0 @@
1import { exec } from 'child_process'
2import { AbstractCommand } from '../shared'
3
4export class CLICommand extends AbstractCommand {
5
6 static exec (command: string) {
7 return new Promise<string>((res, rej) => {
8 exec(command, (err, stdout, _stderr) => {
9 if (err) return rej(err)
10
11 return res(stdout)
12 })
13 })
14 }
15
16 getEnv () {
17 return `NODE_ENV=test NODE_APP_INSTANCE=${this.server.internalServerNumber}`
18 }
19
20 async execWithEnv (command: string, configOverride?: any) {
21 const prefix = configOverride
22 ? `NODE_CONFIG='${JSON.stringify(configOverride)}'`
23 : ''
24
25 return CLICommand.exec(`${prefix} ${this.getEnv()} ${command}`)
26 }
27}