12
12
import java .io .BufferedReader ;
13
13
import java .io .FileNotFoundException ;
14
14
import java .io .IOException ;
15
+ import java .util .List ;
15
16
import java .util .StringJoiner ;
16
17
import java .util .concurrent .BlockingQueue ;
17
18
import java .util .concurrent .LinkedBlockingQueue ;
@@ -28,8 +29,10 @@ public class DefaultBuildListener implements BuildListener
28
29
"error reading preface from client .+?: file has already been closed\n " );
29
30
// Known variants:
30
31
// ERROR: failed to build: resolve : (?:CreateFile|lstat) (.+?): The system cannot find the file specified.
31
- private static final Pattern FILE_NOT_FOUND = Pattern .compile ("ERROR: failed to build: resolve : " +
32
- "(?:CreateFile|lstat) (.+?): The system cannot find the file specified\\ ." );
32
+ // ERROR: resolve : lstat /home/runner/work/anchor4j/anchor4j/buildx/src/test/resources/missing: no such file or directory
33
+ private static final List <Pattern > FILE_NOT_FOUND = List .of (
34
+ Pattern .compile ("ERROR: resolve : CreateFile (.+?): The system cannot find the file specified\\ ." ),
35
+ Pattern .compile ("ERROR: resolve : lstat (.+?): no such file or directory" ));
33
36
private static final String DOCKER_DRIVER_DOES_NOT_SUPPORT_MANIFEST_LIST =
34
37
"ERROR: failed to build: docker exporter does not currently support exporting manifest lists" ;
35
38
private static final String DOCKER_DRIVER_DOES_NOT_SUPPORT_OCI =
@@ -42,7 +45,7 @@ public class DefaultBuildListener implements BuildListener
42
45
private static final Pattern RESOURCE_IN_USE = Pattern .compile ("""
43
46
ERROR: failed to build: no valid drivers found: open (.+?): The process cannot access the file because \
44
47
it is being used by another process\\ .""" );
45
-
48
+
46
49
/**
47
50
* The lines returned by the build's standard output stream.
48
51
*/
@@ -163,9 +166,12 @@ public void buildFailed(CommandResult result) throws IOException
163
166
// "2025/06/11 15:53:20 http2: server: error reading preface from client //./pipe/dockerDesktopLinuxEngine: file has already been closed"
164
167
stderr = stderr .substring (matcher .end ());
165
168
}
166
- matcher = FILE_NOT_FOUND .matcher (stderr );
167
- if (matcher .matches ())
168
- throw new FileNotFoundException (matcher .group (1 ));
169
+ for (Pattern pattern : FILE_NOT_FOUND )
170
+ {
171
+ matcher = pattern .matcher (stderr );
172
+ if (matcher .matches ())
173
+ throw new FileNotFoundException (matcher .group (1 ));
174
+ }
169
175
matcher = BuildXParser .NOT_FOUND .matcher (stderr );
170
176
if (matcher .matches ())
171
177
throw new BuilderNotFoundException (matcher .group (1 ));
0 commit comments