tiny.sandbox.result
Defined in tiny.sandbox.
API (1)
Types and contracts
Public types and contracts.
Result: Holds the resources and captured outputs of an execution, owning the standard output and standard error buffers, the recorded change set, the configurationAudit, and the layer directory.
Source
Source: lib/sandbox/src/result.zig
zig
const std = @import("std");const change = @import("change.zig");const command = @import("command.zig");const layer_data = @import("layer.zig");const audit_data = @import("audit.zig");const Allocator = std.mem.Allocator;/// Holds the resources and captured outputs of an execution, owning the/// standard output and standard error buffers, the recorded change set, the/// configuration `Audit`, and the layer directory.////// Calling `deinit` frees the stream buffers and change set memory, then/// deletes the temporary layer directory. Callers that want to keep files/// generated in the layer must read or copy them out before calling `deinit`.pub const Result = struct { allocator: Allocator, layer: layer_data.Layer, status: command.Status, stdout: []u8, stderr: []u8, changes: change.Set, audit: audit_data.Audit, pub fn deinit(self: *Result) void { self.changes.deinit(); self.allocator.free(self.stdout); self.allocator.free(self.stderr); self.layer.deinit(); self.* = undefined; } /// Reads an output file through the layer directory handle into a buffer /// allocated with `allocator`, transferring ownership of the slice to the /// caller, who must free it using the supplied allocator. Relative path /// resolution starts at the root of the layer directory but performs no /// path-containment checks, allowing lookups that navigate outside the /// layer. The `limit` argument sets the maximum number of bytes to read. pub fn readFileAlloc(self: *const Result, allocator: Allocator, path: []const u8, limit: usize) ![]u8 { return try self.layer.readFileAlloc(allocator, path, limit); }};Source: lib/sandbox/src/root.zig:41
zig
pub const result = @import("result.zig");Audit
| Definitions | 1 |
|---|---|
| Public names | 1 |
| Members | 0 |
| Version | 26.7.0 |
| Revision | daab053ee433 |