@@ -70,22 +70,32 @@ struct Root: AsyncParsableCommand {
7070 HttpStatusCodeRange ( min: 400 , max: 400 ) ,
7171 HttpStatusCodeRange ( min: 402 , max: 599 )
7272 ]
73- }
74- }
75- defer { SentrySDK . flush ( timeout: 2 . seconds. timeInterval) }
7673
77- SentrySDK . configureScope { scope in
78- scope. setExtra ( value: ProcessInfo . processInfo. arguments, key: " Command-line arguments " )
79- }
74+ // https://github.com/cirruslabs/tart/issues/1163
75+ options. enableAppLaunchProfiling = false
76+ options. configureProfiling = {
77+ $0. profileAppStarts = false
78+ }
79+ }
8080
81- // Enrich future events with Cirrus CI-specific tags
82- if let tags = ProcessInfo . processInfo. environment [ " CIRRUS_SENTRY_TAGS " ] {
8381 SentrySDK . configureScope { scope in
84- for (key, value) in tags. split ( separator: " , " ) . compactMap ( { parseCirrusSentryTag ( $0) } ) {
85- scope. setTag ( value: value, key: key)
82+ scope. setExtra ( value: ProcessInfo . processInfo. arguments, key: " Command-line arguments " )
83+ }
84+
85+ // Enrich future events with Cirrus CI-specific tags
86+ if let tags = ProcessInfo . processInfo. environment [ " CIRRUS_SENTRY_TAGS " ] {
87+ SentrySDK . configureScope { scope in
88+ for (key, value) in tags. split ( separator: " , " ) . compactMap ( { parseCirrusSentryTag ( $0) } ) {
89+ scope. setTag ( value: value, key: key)
90+ }
8691 }
8792 }
8893 }
94+ defer {
95+ if ProcessInfo . processInfo. environment [ " SENTRY_DSN " ] != nil {
96+ SentrySDK . flush ( timeout: 2 . seconds. timeInterval)
97+ }
98+ }
8999
90100 // Run garbage-collection before each command (shouldn't take too long)
91101 if type ( of: command) != type ( of: Pull ( ) ) && type ( of: command) != type ( of: Clone ( ) ) {
@@ -109,8 +119,10 @@ struct Root: AsyncParsableCommand {
109119 }
110120
111121 // Capture the error into Sentry
112- SentrySDK . capture ( error: error)
113- SentrySDK . flush ( timeout: 2 . seconds. timeInterval)
122+ if ProcessInfo . processInfo. environment [ " SENTRY_DSN " ] != nil {
123+ SentrySDK . capture ( error: error)
124+ SentrySDK . flush ( timeout: 2 . seconds. timeInterval)
125+ }
114126
115127 // Handle a non-ArgumentParser's exception that requires a specific exit code to be set
116128 if let errorWithExitCode = error as? HasExitCode {
0 commit comments