Skip to content

Commit abcb6a3

Browse files
macmadeclaude
andcommitted
refactor: Rename Task to ProcessTask to avoid shadowing Swift Concurrency
The public Task type shadowed Swift Concurrency's Task. Rename it to ProcessTask and rename the source and test files to match, updating the single production call site and the tests. No behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent fb027fa commit abcb6a3

4 files changed

Lines changed: 22 additions & 22 deletions

File tree

EditorExtension/SourceEditorCommand.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public class SourceEditorCommand: NSObject, XCSourceEditorCommand
7575
return
7676
}
7777

78-
guard let task = Task.run( name: executable, arguments: arguments, input: data )
78+
guard let task = ProcessTask.run( name: executable, arguments: arguments, input: data )
7979
else
8080
{
8181
throw FormatterError.executableNotFound( executable )
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
import Foundation
2626

27-
public class Task
27+
public class ProcessTask
2828
{
2929
private var task: Process
3030
private var pipeOut: Pipe
@@ -34,7 +34,7 @@ public class Task
3434
public private( set ) var standardOutput: Data
3535
public private( set ) var standardError: Data
3636

37-
public class func run( name: String, arguments: [ String ], input: Data? ) -> Task?
37+
public class func run( name: String, arguments: [ String ], input: Data? ) -> ProcessTask?
3838
{
3939
guard let executable = Bundle.main.executableURL?.deletingLastPathComponent().appendingPathComponent( name )
4040
else
@@ -45,15 +45,15 @@ public class Task
4545
return self.run( executableURL: executable, arguments: arguments, input: input )
4646
}
4747

48-
public class func run( executableURL: URL, arguments: [ String ], input: Data? ) -> Task?
48+
public class func run( executableURL: URL, arguments: [ String ], input: Data? ) -> ProcessTask?
4949
{
5050
guard FileManager.default.fileExists( atPath: executableURL.path )
5151
else
5252
{
5353
return nil
5454
}
5555

56-
let task = Task( executable: executableURL, arguments: arguments )
56+
let task = ProcessTask( executable: executableURL, arguments: arguments )
5757

5858
task.run( input: input )
5959

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import Foundation
2626
import Testing
2727

28-
@Suite( "Task — child-process I/O" )
28+
@Suite( "ProcessTask — child-process I/O" )
2929
struct TaskTests
3030
{
3131
// A payload several times larger than the 64 KB kernel pipe buffer. If the
@@ -37,7 +37,7 @@ struct TaskTests
3737
@Test( "Collects complete stdout for input larger than the pipe buffer", .timeLimit( .minutes( 1 ) ) )
3838
func largeInputRoundTrip() throws
3939
{
40-
let task = try #require( Task.run( executableURL: URL( fileURLWithPath: "/bin/cat" ), arguments: [], input: Self.largePayload ) )
40+
let task = try #require( ProcessTask.run( executableURL: URL( fileURLWithPath: "/bin/cat" ), arguments: [], input: Self.largePayload ) )
4141

4242
#expect( task.terminationStatus == 0 )
4343
#expect( task.standardOutput.count == Self.largePayload.count )
@@ -47,7 +47,7 @@ struct TaskTests
4747
@Test( "Captures standard error", .timeLimit( .minutes( 1 ) ) )
4848
func capturesStandardError() throws
4949
{
50-
let task = try #require( Task.run( executableURL: URL( fileURLWithPath: "/bin/sh" ), arguments: [ "-c", "printf 'boom' 1>&2" ], input: nil ) )
50+
let task = try #require( ProcessTask.run( executableURL: URL( fileURLWithPath: "/bin/sh" ), arguments: [ "-c", "printf 'boom' 1>&2" ], input: nil ) )
5151

5252
#expect( task.terminationStatus == 0 )
5353
#expect( String( data: task.standardError, encoding: .utf8 ) == "boom" )
@@ -56,14 +56,14 @@ struct TaskTests
5656
@Test( "Reports a non-zero termination status", .timeLimit( .minutes( 1 ) ) )
5757
func nonZeroTerminationStatus() throws
5858
{
59-
let task = try #require( Task.run( executableURL: URL( fileURLWithPath: "/bin/sh" ), arguments: [ "-c", "exit 3" ], input: nil ) )
59+
let task = try #require( ProcessTask.run( executableURL: URL( fileURLWithPath: "/bin/sh" ), arguments: [ "-c", "exit 3" ], input: nil ) )
6060

6161
#expect( task.terminationStatus == 3 )
6262
}
6363

6464
@Test( "Returns nil for a non-existent executable" )
6565
func missingExecutable()
6666
{
67-
#expect( Task.run( executableURL: URL( fileURLWithPath: "/nonexistent/executable" ), arguments: [], input: nil ) == nil )
67+
#expect( ProcessTask.run( executableURL: URL( fileURLWithPath: "/nonexistent/executable" ), arguments: [], input: nil ) == nil )
6868
}
6969
}

XcodeFormat.xcodeproj/project.pbxproj

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,20 @@
5656
05744ED628EC2EDB00A88503 /* String.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05744ED528EC2EDB00A88503 /* String.swift */; };
5757
05744ED728EC2EDB00A88503 /* String.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05744ED528EC2EDB00A88503 /* String.swift */; };
5858
0594D0022FE1203B002650F9 /* ConfigurationWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0594D0012FE1203B002650F9 /* ConfigurationWindowController.xib */; };
59-
05BED21A28EC4A2A008039F6 /* Task.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05BED21928EC4A2A008039F6 /* Task.swift */; };
60-
05BED21B28EC4A2A008039F6 /* Task.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05BED21928EC4A2A008039F6 /* Task.swift */; };
59+
05BED21A28EC4A2A008039F6 /* ProcessTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05BED21928EC4A2A008039F6 /* ProcessTask.swift */; };
60+
05BED21B28EC4A2A008039F6 /* ProcessTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05BED21928EC4A2A008039F6 /* ProcessTask.swift */; };
6161
05C2595E28EC8233008BDDDE /* XcodeFormat.workflow in Resources */ = {isa = PBXBuildFile; fileRef = 05C2595B28EC8233008BDDDE /* XcodeFormat.workflow */; };
6262
1FC94E1B2C6A97C099672427 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 754426165B1A6F7B9A8AA57D /* Cocoa.framework */; };
6363
22A6089A621DED5B56E879A7 /* ConfigurationURLError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2EF3AB7428EF979DDF19D7B6 /* ConfigurationURLError.swift */; };
6464
393AAC40E0670389A6DA1F01 /* FormatterOutcome.swift in Sources */ = {isa = PBXBuildFile; fileRef = B525D96BC0786913A529715D /* FormatterOutcome.swift */; };
6565
3D5B82DA28BD1E95AA93253A /* CursorPositionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D7074E40EFC210EB5BEF6A5 /* CursorPositionTests.swift */; };
6666
415B69E897EF098F1D497C6B /* String.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05744ED528EC2EDB00A88503 /* String.swift */; };
67-
422C428BA7CBC2B94FD892A0 /* Task.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05BED21928EC4A2A008039F6 /* Task.swift */; };
67+
422C428BA7CBC2B94FD892A0 /* ProcessTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05BED21928EC4A2A008039F6 /* ProcessTask.swift */; };
6868
42625EB1C14BE557D2C884C0 /* FormatterOutcomeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8EAF9AF3502DEDA70432E27 /* FormatterOutcomeTests.swift */; };
6969
430C2F21B01A0C20B2A0B41D /* FormatterErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B49163E30C3B9E7BC97B7C6 /* FormatterErrorTests.swift */; };
7070
520812B973DDE22F15845E54 /* FormatterError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BB18C081049DED53951BA35 /* FormatterError.swift */; };
7171
52C07AA4ACA79DEA083917ED /* URL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05744ECD28EC2E5000A88503 /* URL.swift */; };
72-
54AF1A10772285FD73793431 /* TaskTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 913F32B63DB056684754D787 /* TaskTests.swift */; };
72+
54AF1A10772285FD73793431 /* ProcessTaskTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 913F32B63DB056684754D787 /* ProcessTaskTests.swift */; };
7373
5D1B0EB0A339B282FE2884BB /* FormatterOutcome.swift in Sources */ = {isa = PBXBuildFile; fileRef = B525D96BC0786913A529715D /* FormatterOutcome.swift */; };
7474
6AF1DB0943F9AA065EA80860 /* URLTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B907F7DC445EA71845A03EE9 /* URLTests.swift */; };
7575
6CE2C56F18102DBE76DAA3AD /* UncrustifyLanguageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9872753262CE5731D808C3E0 /* UncrustifyLanguageTests.swift */; };
@@ -257,7 +257,7 @@
257257
05744ED228EC2ED400A88503 /* Data.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Data.swift; sourceTree = "<group>"; };
258258
05744ED528EC2EDB00A88503 /* String.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = String.swift; sourceTree = "<group>"; };
259259
0594D0002FE1203B002650F9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/ConfigurationWindowController.xib; sourceTree = "<group>"; };
260-
05BED21928EC4A2A008039F6 /* Task.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Task.swift; sourceTree = "<group>"; };
260+
05BED21928EC4A2A008039F6 /* ProcessTask.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProcessTask.swift; sourceTree = "<group>"; };
261261
05C2595B28EC8233008BDDDE /* XcodeFormat.workflow */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = XcodeFormat.workflow; sourceTree = "<group>"; };
262262
063A2606544CBB8F999B2511 /* ConfigurationURLTests.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = ConfigurationURLTests.swift; sourceTree = "<group>"; };
263263
156C3284ADF849DBE528A272 /* UncrustifyLanguage.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = UncrustifyLanguage.swift; sourceTree = "<group>"; };
@@ -269,7 +269,7 @@
269269
4D7074E40EFC210EB5BEF6A5 /* CursorPositionTests.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = CursorPositionTests.swift; sourceTree = "<group>"; };
270270
754426165B1A6F7B9A8AA57D /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/Cocoa.framework; sourceTree = DEVELOPER_DIR; };
271271
78DA3F1F404A081C0DE85CA4 /* ConfigurationTests.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = ConfigurationTests.swift; sourceTree = "<group>"; };
272-
913F32B63DB056684754D787 /* TaskTests.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = TaskTests.swift; sourceTree = "<group>"; };
272+
913F32B63DB056684754D787 /* ProcessTaskTests.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = ProcessTaskTests.swift; sourceTree = "<group>"; };
273273
9872753262CE5731D808C3E0 /* UncrustifyLanguageTests.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = UncrustifyLanguageTests.swift; sourceTree = "<group>"; };
274274
B525D96BC0786913A529715D /* FormatterOutcome.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = FormatterOutcome.swift; sourceTree = "<group>"; };
275275
B907F7DC445EA71845A03EE9 /* URLTests.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = URLTests.swift; sourceTree = "<group>"; };
@@ -565,7 +565,7 @@
565565
050E0F6128EB66390080C562 /* Configuration.swift */,
566566
05C2595F28EC8A5C008BDDDE /* Extensions */,
567567
050E0F5E28EB65BA0080C562 /* Preferences.swift */,
568-
05BED21928EC4A2A008039F6 /* Task.swift */,
568+
05BED21928EC4A2A008039F6 /* ProcessTask.swift */,
569569
156C3284ADF849DBE528A272 /* UncrustifyLanguage.swift */,
570570
B525D96BC0786913A529715D /* FormatterOutcome.swift */,
571571
3BB18C081049DED53951BA35 /* FormatterError.swift */,
@@ -608,7 +608,7 @@
608608
children = (
609609
B907F7DC445EA71845A03EE9 /* URLTests.swift */,
610610
78DA3F1F404A081C0DE85CA4 /* ConfigurationTests.swift */,
611-
913F32B63DB056684754D787 /* TaskTests.swift */,
611+
913F32B63DB056684754D787 /* ProcessTaskTests.swift */,
612612
9872753262CE5731D808C3E0 /* UncrustifyLanguageTests.swift */,
613613
D8EAF9AF3502DEDA70432E27 /* FormatterOutcomeTests.swift */,
614614
3B49163E30C3B9E7BC97B7C6 /* FormatterErrorTests.swift */,
@@ -810,7 +810,7 @@
810810
050E0F6928EB84C90080C562 /* ConfigurationWindowController.swift in Sources */,
811811
050E0E4028EB307B0080C562 /* ApplicationDelegate.swift in Sources */,
812812
050E0F1628EB3FB20080C562 /* CreditViewController.swift in Sources */,
813-
05BED21A28EC4A2A008039F6 /* Task.swift in Sources */,
813+
05BED21A28EC4A2A008039F6 /* ProcessTask.swift in Sources */,
814814
050E0F6728EB83CC0080C562 /* ArrayIsNotEmpty.swift in Sources */,
815815
050E0F1728EB3FB20080C562 /* AboutWindowController.swift in Sources */,
816816
0527679728EC1DE60019311B /* FileManager.swift in Sources */,
@@ -843,7 +843,7 @@
843843
050E0F6028EB65BA0080C562 /* Preferences.swift in Sources */,
844844
05744ED428EC2ED400A88503 /* Data.swift in Sources */,
845845
05744ED728EC2EDB00A88503 /* String.swift in Sources */,
846-
05BED21B28EC4A2A008039F6 /* Task.swift in Sources */,
846+
05BED21B28EC4A2A008039F6 /* ProcessTask.swift in Sources */,
847847
0527679828EC1E580019311B /* FileManager.swift in Sources */,
848848
CA9C26A026E8351452F19284 /* UncrustifyLanguage.swift in Sources */,
849849
FFFFB23BFC620B462FF4B4DB /* FormatterOutcome.swift in Sources */,
@@ -864,8 +864,8 @@
864864
F6C5BD72DEADFD34F541C38B /* FileManager.swift in Sources */,
865865
415B69E897EF098F1D497C6B /* String.swift in Sources */,
866866
52C07AA4ACA79DEA083917ED /* URL.swift in Sources */,
867-
422C428BA7CBC2B94FD892A0 /* Task.swift in Sources */,
868-
54AF1A10772285FD73793431 /* TaskTests.swift in Sources */,
867+
422C428BA7CBC2B94FD892A0 /* ProcessTask.swift in Sources */,
868+
54AF1A10772285FD73793431 /* ProcessTaskTests.swift in Sources */,
869869
6CE2C56F18102DBE76DAA3AD /* UncrustifyLanguageTests.swift in Sources */,
870870
757F7D103067E09A06177437 /* UncrustifyLanguage.swift in Sources */,
871871
42625EB1C14BE557D2C884C0 /* FormatterOutcomeTests.swift in Sources */,

0 commit comments

Comments
 (0)