@@ -10,7 +10,6 @@ import Combine
1010import SwiftTerm
1111
1212/// Stores the state of a task once it's executed
13- @MainActor
1413class CEActiveTask : ObservableObject , Identifiable , Hashable {
1514 /// The current progress of the task.
1615 @Published var output : CEActiveTaskTerminalView ?
@@ -44,6 +43,7 @@ class CEActiveTask: ObservableObject, Identifiable, Hashable {
4443 } . store ( in: & cancellables)
4544 }
4645
46+ @MainActor
4747 func run( workspaceURL: URL ? ) {
4848 self . workspaceURL = workspaceURL
4949 self . activeTaskID = UUID ( ) // generate a new ID for this run
@@ -57,6 +57,7 @@ class CEActiveTask: ObservableObject, Identifiable, Hashable {
5757 output = view
5858 }
5959
60+ @MainActor
6061 func handleProcessFinished( terminationStatus: Int32 ) {
6162 if terminationStatus == 0 {
6263 output? . newline ( )
@@ -96,13 +97,15 @@ class CEActiveTask: ObservableObject, Identifiable, Hashable {
9697 deleteStatusTaskNotification ( )
9798 }
9899
100+ @MainActor
99101 func suspend( ) {
100102 if let pid = output? . runningPID ( ) , status == . running {
101103 kill ( pid, SIGSTOP)
102104 updateTaskStatus ( to: . stopped)
103105 }
104106 }
105107
108+ @MainActor
106109 func resume( ) {
107110 if let pid = output? . runningPID ( ) , status == . stopped {
108111 kill ( pid, SIGCONT)
@@ -132,6 +135,7 @@ class CEActiveTask: ObservableObject, Identifiable, Hashable {
132135 }
133136 }
134137
138+ @MainActor
135139 func clearOutput( ) {
136140 output? . terminal. resetToInitialState ( )
137141 output? . feed ( text: " " )
0 commit comments