diff --git a/Sources/Swiftly/Init.swift b/Sources/Swiftly/Init.swift index f5c9f917..74924913 100644 --- a/Sources/Swiftly/Init.swift +++ b/Sources/Swiftly/Init.swift @@ -76,6 +76,7 @@ internal struct Init: SwiftlyCommand { These locations can be changed with SWIFTLY_HOME and SWIFTLY_BIN environment variables and run this again. \(installMsg) """) + guard SwiftlyCore.promptForConfirmation(defaultBehavior: true) else { throw SwiftlyError(message: "Swiftly installation has been cancelled") } diff --git a/Sources/SwiftlyCore/Platform.swift b/Sources/SwiftlyCore/Platform.swift index 780afe18..44af8c39 100644 --- a/Sources/SwiftlyCore/Platform.swift +++ b/Sources/SwiftlyCore/Platform.swift @@ -209,6 +209,11 @@ extension Platform { if pgid != -1 { tcsetpgrp(STDOUT_FILENO, process.processIdentifier) } + + defer { if pgid != -1 { + tcsetpgrp(STDOUT_FILENO, pgid) + }} + process.waitUntilExit() guard process.terminationStatus == 0 else { @@ -250,6 +255,10 @@ extension Platform { if pgid != -1 { tcsetpgrp(STDOUT_FILENO, process.processIdentifier) } + defer { if pgid != -1 { + tcsetpgrp(STDOUT_FILENO, pgid) + }} + let outData = try outPipe.fileHandleForReading.readToEnd() process.waitUntilExit()