From bc099cca122e076b1958faf4a44634a1a71ad989 Mon Sep 17 00:00:00 2001 From: Brian Zalewski Date: Fri, 2 Dec 2022 17:25:27 +0000 Subject: [PATCH] Update .local/bin/install-program, .local/share/chezmoi/home/dot_local/bin/executable_install-program --- .local/bin/install-program | 14 +++++++------- .../dot_local/bin/executable_install-program | 16 ++++++++-------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.local/bin/install-program b/.local/bin/install-program index 0611be6a..774397b1 100644 --- a/.local/bin/install-program +++ b/.local/bin/install-program @@ -243,25 +243,25 @@ async function beforeInstall(packageManager) { } else if (packageManager === 'snap') { } else if (packageManager === 'whalebrew') { if (osType === 'darwin') { - const docker = await which('docker') + const docker = which.sync('docker', { nothrow: true }) if (!docker) { await $`brew install --cask docker` } try { await $`docker run --rm hello-world` } catch (e) { - await $`logg warn 'The command \`docker run --rm hello-world\` failed` + await $`logg warn 'The command \`docker run --rm hello-world\` failed'` try { - await $`test -f /Applications/Docker.app` - await $`logg info 'Attempting to open \`Applications/Docker.app\` (Docker Desktop for macOS). This should take about 30 seconds.'` - const gum = await which('gum') + const promises = [$`test -d /Applications/Docker.app`, $`logg info 'Attempting to open \`/Applications/Docker.app\` (Docker Desktop for macOS). This should take about 30 seconds.'`, $`open /Applications/Docker.app`] + await Promise.all(promises) + const gum = which.sync('gum', { nothrow: true }) if (gum) { - await $`gum spin --spinner dot --title "Waiting for Docker Desktop to start up.." -- sleep 30` + execSync('gum spin --spinner dot --title "Waiting for Docker Desktop to start up.." -- sleep 30', {stdio: 'inherit', shell: true}) } else { await $`sleep 30` } } catch (e) { - await $`logg warn 'Docker Desktop appears to not be installed!` + await $`logg warn 'Docker Desktop appears to not be installed!'` } } } diff --git a/.local/share/chezmoi/home/dot_local/bin/executable_install-program b/.local/share/chezmoi/home/dot_local/bin/executable_install-program index 55cfa4e4..da8717c8 100644 --- a/.local/share/chezmoi/home/dot_local/bin/executable_install-program +++ b/.local/share/chezmoi/home/dot_local/bin/executable_install-program @@ -242,26 +242,26 @@ async function beforeInstall(packageManager) { } else if (packageManager === 'flatpak') { } else if (packageManager === 'snap') { } else if (packageManager === 'whalebrew') { -if (osType === 'darwin') { - const docker = await which('docker') + if (osType === 'darwin') { + const docker = which.sync('docker', { nothrow: true }) if (!docker) { await $`brew install --cask docker` } try { await $`docker run --rm hello-world` } catch (e) { - await $`logg warn 'The command \`docker run --rm hello-world\` failed` + await $`logg warn 'The command \`docker run --rm hello-world\` failed'` try { - await $`test -f /Applications/Docker.app` - await $`logg info 'Attempting to open \`Applications/Docker.app\` (Docker Desktop for macOS). This should take about 30 seconds.'` - const gum = await which('gum') + const promises = [$`test -d /Applications/Docker.app`, $`logg info 'Attempting to open \`/Applications/Docker.app\` (Docker Desktop for macOS). This should take about 30 seconds.'`, $`open /Applications/Docker.app`] + await Promise.all(promises) + const gum = which.sync('gum', { nothrow: true }) if (gum) { - await $`gum spin --spinner dot --title "Waiting for Docker Desktop to start up.." -- sleep 30` + execSync('gum spin --spinner dot --title "Waiting for Docker Desktop to start up.." -- sleep 30', {stdio: 'inherit', shell: true}) } else { await $`sleep 30` } } catch (e) { - await $`logg warn 'Docker Desktop appears to not be installed!` + await $`logg warn 'Docker Desktop appears to not be installed!'` } } }