Skip to content

Commit feddbe0

Browse files
refactor(cli): calculate process output buffer size dynamically
- use std pow to calculate process output buffer size base 2
1 parent d77965d commit feddbe0

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

src/cli/cli.zig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,7 @@ fn compileCurrentExercise(self: *CLI) !void {
204204

205205
self.current_exercise_stdout.clearAndFree(self.allocator);
206206

207-
// FIX: dynamically allocate max output bytes for stdout
208-
try process.collectOutput(self.allocator, &self.current_exercise_stdout, &self.current_exercise_stderr, 65_536); // 16 bit output
207+
try process.collectOutput(self.allocator, &self.current_exercise_stdout, &self.current_exercise_stderr, STD.math.pow(usize, 2, 16)); // 16 bit output
209208
const PROCESS_STATUS = try process.wait();
210209

211210
if (PROCESS_STATUS.Exited == 0) {

0 commit comments

Comments
 (0)