Skip to content

Commit

Permalink
Rename to run
Browse files Browse the repository at this point in the history
  • Loading branch information
kla committed May 26, 2024
1 parent 839bd20 commit 6497e92
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/docker.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { exit, fileExists } from './utils'
import { runAsync, capture } from './shell'
import { run, capture } from './shell'
import Container from './container'

async function compose(contextName: string, command: string, path: string, options: Record<string,any> = {}) {
Expand All @@ -9,12 +9,12 @@ async function compose(contextName: string, command: string, path: string, optio

// See if path is actually a container name
if (Container.find(contextName, path))
return runAsync(`${base} ${command}${options.append ? ` ${path}` : ''}`, options)
return run(`${base} ${command}${options.append ? ` ${path}` : ''}`, options)

if (options.exit && !fileExists(path))
exit(1, `👿 '${path}' must point to a valid docker-compose yaml file`)

return runAsync(`${base} -f ${path} ${command}`, options)
return run(`${base} -f ${path} ${command}`, options)
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function capture(command: string) {
return execSync(command, { encoding: 'utf-8' }).trim()
}

export async function runAsync(command: string, { env } = {}) {
export async function run(command: string, { env } = {}) {
const args = command.split(' ')
const executable = args.shift()
const options: any = { stdio: 'inherit', tty: true }
Expand Down

0 comments on commit 6497e92

Please sign in to comment.