@@ -20,7 +20,9 @@ module Session (
20
20
, hasSpec
21
21
, hasHspecCommandSignature
22
22
, hspecCommand
23
+ , Extract (.. )
23
24
, extractSummary
25
+ , ansiShowCursor
24
26
#endif
25
27
) where
26
28
@@ -123,16 +125,21 @@ isSuccess = not . isFailure
123
125
extractSummary :: Extract Summary
124
126
extractSummary = Extract {
125
127
isPartialMessage = partialMessageStartsWithOneOf [summaryPrefix, ansiShowCursor <> summaryPrefix]
126
- , parseMessage = fmap ( flip (,) " " ) . parseSummary
128
+ , parseMessage
127
129
} where
128
130
summaryPrefix :: ByteString
129
131
summaryPrefix = " Summary {"
130
132
133
+ parseMessage :: ByteString -> Maybe (Summary , ByteString )
134
+ parseMessage input = case ByteString. stripPrefix ansiShowCursor input of
135
+ Nothing -> flip (,) " " <$> parseSummary input
136
+ Just i -> flip (,) ansiShowCursor <$> parseSummary i
137
+
131
138
parseSummary :: ByteString -> Maybe Summary
132
139
parseSummary = readMaybe . decodeUtf8 . stripAnsiShowCursor
133
140
134
- ansiShowCursor :: ByteString
135
- ansiShowCursor = " \ESC [?25h"
136
-
137
141
stripAnsiShowCursor :: ByteString -> ByteString
138
142
stripAnsiShowCursor input = fromMaybe input $ ByteString. stripPrefix ansiShowCursor input
143
+
144
+ ansiShowCursor :: ByteString
145
+ ansiShowCursor = " \ESC [?25h"
0 commit comments