Fixed line returns on exec Post hook and Pre hook

This commit is contained in:
Brian Zalewski 2023-08-30 17:38:09 -04:00 committed by GitHub
parent fcb03102ec
commit 547d7802e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -91,6 +91,7 @@ function wrapMessage(msg) {
function runCommand(spinnerTitle, command) { function runCommand(spinnerTitle, command) {
// execSync(command.includes('sudo') ? `sudo "$(which gum)" spin --spinner dot --title "${spinnerTitle}" -- ${command}` : `gum spin --spinner dot --title "${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) log('info', 'CMD', spinnerTitle)
console.log(command)
execSync(command, { execSync(command, {
stdio: 'inherit', stdio: 'inherit',
shell: true, shell: true,
@ -1882,7 +1883,7 @@ async function installSoftware(pkgsToInstall) {
} }
installOrdersPre.length && log('info', 'Pre-Install', `Running package-specific pre-installation steps`) installOrdersPre.length && log('info', 'Pre-Install', `Running package-specific pre-installation steps`)
for (const script of installOrdersPre) { 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`) installOrdersGroups.length && log('info', 'Users / Groups', `Adding groups / users`)
for (const group of installOrdersGroups) { for (const group of installOrdersGroups) {
@ -1910,7 +1911,7 @@ async function installSoftware(pkgsToInstall) {
for (const script of installOrdersPost) { for (const script of installOrdersPost) {
try { try {
log('info', 'Post Hook', script) log('info', 'Post Hook', script)
await $`${script.replace(/\n/g, '\n')}` await $`${script.replace(/\n/g, "\\\n")}`
} catch(e) { } catch(e) {
log('info', 'Post-Install Hook', 'Encountered error while running post-install hook') log('info', 'Post-Install Hook', 'Encountered error while running post-install hook')
} }