From 39073b349efd0a16572c9d1358f29967d1b10392 Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 9 Jan 2025 09:43:33 +0100 Subject: [PATCH] feat(docker): allow string command in runExec and runOcc Signed-off-by: Max --- lib/docker.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/docker.ts b/lib/docker.ts index c57cd63b..9d2d48e2 100644 --- a/lib/docker.ts +++ b/lib/docker.ts @@ -228,7 +228,7 @@ export const configureNextcloud = async function(apps = ['viewer'], vendoredBran console.log('\nConfiguring Nextcloud…') container = container ?? getContainer() - await runOcc(['--version'], { container, verbose: true }) + await runOcc('--version', { container, verbose: true }) // Be consistent for screenshots await setSystemConfig('default_language', 'en', { container }) @@ -376,12 +376,12 @@ interface RunExecOptions { * Execute a command in the container */ export const runExec = async function( - command: string[], + command: string | string[], { container, user='www-data', verbose=false, env=[] }: Partial = {}, ) { container = container || getContainer() const exec = await container.exec({ - Cmd: command, + Cmd: typeof command === 'string' ? [command] : command, AttachStdout: true, AttachStderr: true, User: user, @@ -418,10 +418,11 @@ export const runExec = async function( * Execute an occ command in the container */ export const runOcc = function( - occCommand: string[], + command: string | string[], { container, env=[], verbose=false }: Partial> = {}, ) { - return runExec(['php', 'occ', ...occCommand], { container, verbose, env }) + const cmdArray = typeof command === 'string' ? [command] : command + return runExec(['php', 'occ', ...cmdArray], { container, verbose, env }) } /**