Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
c47c0cc
Refactor safe mode execution to use a dedicated method for Docker run…
Jabe03 Oct 9, 2026
77546a2
Implement safe mode execution with maximum runs and proper termination
Jabe03 Oct 9, 2026
3cfa0b1
Apply the docker kill timeout before reading its output
Jabe03 Oct 16, 2026
f554b5f
Give the docker client time to exit before killing its container
Jabe03 Oct 16, 2026
5e9e7e0
Resize the safe mode run limit in place
Jabe03 Oct 16, 2026
11d861b
Hold safe mode run slots with try-with-resources
Jabe03 Oct 16, 2026
c87e86d
Stop waiting for a safe mode run slot after 60 s in the interpreter
Jabe03 Oct 16, 2026
fc062fc
Build the Kind 2 command prefix in one place
Jabe03 Oct 16, 2026
7d230a4
Read the interpreter's stderr and report it when there is no trace
Jabe03 Oct 16, 2026
3fcce9f
Send the Lustre program to Kind 2 as UTF-8
Jabe03 Oct 16, 2026
fa98f3b
Wrap interpreter output parse errors in a Kind2Exception
Jabe03 Oct 30, 2026
fbaee53
Report interpreter stderr only when stdout has no usable output
Jabe03 Oct 30, 2026
d40d283
Give up waiting for a safe mode run after 60 s in execute without a m…
Jabe03 Oct 30, 2026
ad64ac9
Clear the interrupt flag while stopping a run
Jabe03 Oct 30, 2026
0f66902
Remove a cancelled run's container once its client has exited
Jabe03 Oct 30, 2026
5ff671b
Run checkAvailable under the safe mode run management
Jabe03 Oct 30, 2026
7e66f85
Read safeMode once per run
Jabe03 Oct 30, 2026
36d0462
Hold run slots the same way everywhere
Jabe03 Oct 30, 2026
53324ed
Decode output read by ApiUtil.readAll as UTF-8
Jabe03 Oct 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/main/java/edu/uiowa/cs/clc/kind2/api/ApiUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@

import static java.util.stream.Collectors.joining;

import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.List;

import edu.uiowa.cs.clc.kind2.Kind2Exception;
Expand Down Expand Up @@ -67,20 +68,21 @@ public static File writeTempFile(String fileName, String fileExt, String content
}

/**
* Reads a stream to its end.
* Reads a stream to its end and decodes it as UTF-8.
*
* @param inputStream the stream to read
* @return the full contents of the stream
* @throws java.io.IOException if the stream cannot be read
*/
public static String readAll(InputStream inputStream) throws IOException {
StringBuilder result = new StringBuilder();
BufferedInputStream buffered = new BufferedInputStream(inputStream);
int i;
while ((i = buffered.read()) != -1) {
result.append((char) i);
// Decode once at the end, so that a multi-byte character is never split between two reads.
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
byte[] buffer = new byte[4096];
int n;
while ((n = inputStream.read(buffer)) != -1) {
bytes.write(buffer, 0, n);
}
return result.toString();
return new String(bytes.toByteArray(), StandardCharsets.UTF_8);
}

/**
Expand Down
Loading
Loading