Skip to documentation
SLOP

tiny.sandbox.macos

Reference tiny.sandbox macos

Defined in tiny.sandbox.

API (3)

Actions

Public operations.

No direct callersNo direct callstiny.sandboxmacos
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Called byCallsNo direct callsmacosexecuteprivate sourcelib.sandbox.src.runexpectedAuditmacosaudit
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callsmacosexecutemacosavailable
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallstest sourcelib.sandbox.src.macostest: macos backend is unavailable aw...test sourcelib.sandbox.src.macostest: macos backend keeps Plan Result...runexecutecopiedexecutemacosauditmacosavailablemacosexecute
Static calls · unresolved targets: 0 · external targets: 0.

Source: lib/sandbox/src/macos.zig

zig
const std = @import("std");const builtin = @import("builtin");const sys = @import("sys");const audit_data = @import("audit.zig");const change = @import("change.zig");const copied = @import("copied.zig");const plan_data = @import("plan.zig");const result_data = @import("result.zig");const Allocator = std.mem.Allocator;const fs_io = sys.fs.debugIo();pub fn available() bool {    return builtin.os.tag == .macos;}pub fn audit(plan: plan_data.Plan) audit_data.Audit {    return .{        .runner = .macos_staging,        .filesystem = .copied,        .process = .host,        .network = .inherited,        .environment = if (plan.environ_map == null) .inherited else .replaced,    };}pub fn execute(allocator: Allocator, plan: plan_data.Plan) !result_data.Result {    if (!available()) return error.UnsupportedRunner;    return try copied.execute(allocator, plan, audit(plan));}test "macos backend is unavailable away from macos" {    if (comptime builtin.os.tag == .macos) return error.SkipZigTest;    var scratch = std.testing.tmpDir(.{});    defer scratch.cleanup();    const argv = [_][]const u8{ "bash", "-c", ":" };    try std.testing.expectError(error.UnsupportedRunner, execute(std.testing.allocator, .{        .scratch = scratch.dir,        .argv = argv[0..],        .runner = .macos_staging,        .prefix = "macos-unavailable",        .max_file_bytes = 1024,    }));}test "macos backend keeps Plan Result contract on macos" {    if (comptime builtin.os.tag != .macos) return error.SkipZigTest;    var source = std.testing.tmpDir(.{});    defer source.cleanup();    var scratch = std.testing.tmpDir(.{});    defer scratch.cleanup();    try source.dir.writeFile(fs_io, .{ .sub_path = "a.txt", .data = "old" });    const argv = [_][]const u8{ "bash", "-c", "printf changed > a.txt; printf new > new.txt" };    var result = try execute(std.testing.allocator, .{        .scratch = scratch.dir,        .source = source.dir,        .argv = argv[0..],        .runner = .macos_staging,        .prefix = "macos-contract",        .max_file_bytes = 1024,    });    defer result.deinit();    try std.testing.expectEqual(audit_data.Runner.macos_staging, result.audit.runner);    try std.testing.expectEqual(audit_data.Filesystem.copied, result.audit.filesystem);    try std.testing.expectEqual(audit_data.Process.host, result.audit.process);    try std.testing.expectEqual(change.Operation.put, result.changes.find("a.txt").?.operation);    try std.testing.expectEqual(change.Operation.put, result.changes.find("new.txt").?.operation);}

Source: lib/sandbox/src/root.zig:37

zig
pub const macos = @import("macos.zig");

Audit

Definitions4
Public names4
Members0
Version26.7.0
Revisiondaab053ee433