Skip to content

Commit d6ea45d

Browse files
committed
TSCBasic: remove some deprecated interfaces in Process
These interfaces were deprecated in 2022, remove these now. While there were some instances of the `init` still in use. Thanks to @MaxDesiatov and @weissi for the help to verify the safe removal of these deprecated interfaces.
1 parent 91d1a0b commit d6ea45d

File tree

1 file changed

+1
-82
lines changed

1 file changed

+1
-82
lines changed

Sources/TSCBasic/Process/Process.swift

+1-82
Original file line numberDiff line numberDiff line change
@@ -239,45 +239,7 @@ public final class Process {
239239
}
240240
}
241241

242-
// deprecated 2/2022, remove once client migrate to logging handler
243-
@available(*, deprecated)
244-
public static var verbose: Bool {
245-
get {
246-
Self.loggingHandler != nil
247-
} set {
248-
Self.loggingHandler = newValue ? Self.logToStdout: .none
249-
}
250-
}
251-
252-
private var _loggingHandler: LoggingHandler?
253-
254-
// the log and setter are only required to backward support verbose setter.
255-
// remove and make loggingHandler a let property once verbose is deprecated
256-
private let loggingHandlerLock = NSLock()
257-
public private(set) var loggingHandler: LoggingHandler? {
258-
get {
259-
self.loggingHandlerLock.withLock {
260-
self._loggingHandler
261-
}
262-
}
263-
set {
264-
self.loggingHandlerLock.withLock {
265-
self._loggingHandler = newValue
266-
}
267-
}
268-
}
269-
270-
// deprecated 2/2022, remove once client migrate to logging handler
271-
// also simplify loggingHandler (see above) once this is removed
272-
@available(*, deprecated)
273-
public var verbose: Bool {
274-
get {
275-
self.loggingHandler != nil
276-
}
277-
set {
278-
self.loggingHandler = newValue ? Self.logToStdout : .none
279-
}
280-
}
242+
public let loggingHandler: LoggingHandler?
281243

282244
/// The current environment.
283245
@available(*, deprecated, message: "use ProcessEnv.vars instead")
@@ -377,31 +339,6 @@ public final class Process {
377339
self.loggingHandler = loggingHandler ?? Process.loggingHandler
378340
}
379341

380-
// deprecated 2/2022
381-
@_disfavoredOverload
382-
@available(*, deprecated, message: "use version without verbosity flag")
383-
@available(macOS 10.15, *)
384-
public convenience init(
385-
arguments: [String],
386-
environment: [String: String] = ProcessEnv.vars,
387-
workingDirectory: AbsolutePath,
388-
outputRedirection: OutputRedirection = .collect,
389-
verbose: Bool,
390-
startNewProcessGroup: Bool = true
391-
) {
392-
self.init(
393-
arguments: arguments,
394-
environment: environment,
395-
workingDirectory: workingDirectory,
396-
outputRedirection: outputRedirection,
397-
startNewProcessGroup: startNewProcessGroup,
398-
loggingHandler: verbose ? { message in
399-
stdoutStream.send(message).send("\n")
400-
stdoutStream.flush()
401-
} : nil
402-
)
403-
}
404-
405342
/// Create a new process instance.
406343
///
407344
/// - Parameters:
@@ -428,24 +365,6 @@ public final class Process {
428365
self.loggingHandler = loggingHandler ?? Process.loggingHandler
429366
}
430367

431-
@_disfavoredOverload
432-
@available(*, deprecated, message: "use version without verbosity flag")
433-
public convenience init(
434-
arguments: [String],
435-
environment: [String: String] = ProcessEnv.vars,
436-
outputRedirection: OutputRedirection = .collect,
437-
verbose: Bool = Process.verbose,
438-
startNewProcessGroup: Bool = true
439-
) {
440-
self.init(
441-
arguments: arguments,
442-
environment: environment,
443-
outputRedirection: outputRedirection,
444-
startNewProcessGroup: startNewProcessGroup,
445-
loggingHandler: verbose ? Self.logToStdout : .none
446-
)
447-
}
448-
449368
public convenience init(
450369
args: String...,
451370
environment: [String: String] = ProcessEnv.vars,

0 commit comments

Comments
 (0)