From 547d7802e9215f2550a7829b56fb87d53a90b6a2 Mon Sep 17 00:00:00 2001 From: Brian Zalewski <59970525+ProfessorManhattan@users.noreply.github.com> Date: Wed, 30 Aug 2023 17:38:09 -0400 Subject: [PATCH] Fixed line returns on exec Post hook and Pre hook --- home/dot_local/bin/executable_install-program | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/home/dot_local/bin/executable_install-program b/home/dot_local/bin/executable_install-program index c5ac83b2..ca939994 100644 --- a/home/dot_local/bin/executable_install-program +++ b/home/dot_local/bin/executable_install-program @@ -91,6 +91,7 @@ function wrapMessage(msg) { function runCommand(spinnerTitle, command) { // execSync(command.includes('sudo') ? `sudo "$(which gum)" spin --spinner dot --title "${spinnerTitle}" -- ${command}` : `gum spin --spinner dot --title "${spinnerTitle}" -- ${command}`, { log('info', 'CMD', spinnerTitle) + console.log(command) execSync(command, { stdio: 'inherit', shell: true, @@ -1882,7 +1883,7 @@ async function installSoftware(pkgsToInstall) { } installOrdersPre.length && log('info', 'Pre-Install', `Running package-specific pre-installation steps`) for (const script of installOrdersPre) { - await $`${script.replace(/\n/g, '\n')}` + await $`${script.replace(/\n/g, "\\\n")}` } installOrdersGroups.length && log('info', 'Users / Groups', `Adding groups / users`) for (const group of installOrdersGroups) { @@ -1910,7 +1911,7 @@ async function installSoftware(pkgsToInstall) { for (const script of installOrdersPost) { try { log('info', 'Post Hook', script) - await $`${script.replace(/\n/g, '\n')}` + await $`${script.replace(/\n/g, "\\\n")}` } catch(e) { log('info', 'Post-Install Hook', 'Encountered error while running post-install hook') }