Skip to content

Commit f7f9e3d

Browse files
committed
rich main and IoSource rng
1 parent 129c66e commit f7f9e3d

3 files changed

Lines changed: 8 additions & 9 deletions

File tree

src/components/fs/common.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ fn Executor(comptime T: type) type {
166166

167167
error.Canceled => error.Canceled,
168168

169-
error.DeviceBusy,
169+
// error.DeviceBusy,
170170
error.AccessDenied,
171171
error.SystemResources,
172172
error.NoDevice,

src/components/part/GptPartitionTable.zig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@ fn parsePartition(ctx: dim.Context, stdio: std.Io) !Partition {
149149
}
150150

151151
pub fn render(table: *PartTable, io: std.Io, stream: *dim.BinaryStream) dim.Content.RenderError!void {
152-
const random = std.crypto.random;
152+
var r: std.Random.IoSource = .{ .io = io };
153+
const random = r.interface();
153154

154155
const lba_len = stream.length / block_size;
155156
const secondary_pth_lba = lba_len - 1;

src/dim.zig

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,15 @@ var global_deps_buffer: []u8 = undefined;
6666
var global_deps_file_writer: std.fs.File.Writer = undefined;
6767
var global_deps_writer: *std.Io.Writer = undefined;
6868

69-
pub fn main() !u8 {
69+
pub fn main(init: std.process.Init) !u8 {
7070
var gpa_impl: std.heap.DebugAllocator(.{}) = .init;
7171
defer _ = gpa_impl.deinit();
7272

7373
const gpa = gpa_impl.allocator();
7474

75-
var io: std.Io.Threaded = .init(gpa, .{});
76-
const io_iface = io.ioBasic();
75+
const io_iface = init.io;
7776

78-
const opts = try args.parseForCurrentProcess(Options, gpa, .print);
77+
const opts = try args.parseForCurrentProcess(Options, gpa, init.minimal.args, .print);
7978
defer opts.deinit();
8079

8180
const options = opts.options;
@@ -86,8 +85,7 @@ pub fn main() !u8 {
8685
var var_map: VariableMap = .empty;
8786
defer var_map.deinit(gpa);
8887

89-
var env_map = try std.process.getEnvMap(gpa);
90-
defer env_map.deinit();
88+
var env_map = init.environ_map;
9189

9290
if (options.@"import-env") {
9391
var iter = env_map.iterator();
@@ -571,7 +569,7 @@ pub const FileName = struct {
571569
error.BadPathName,
572570
=> return error.InvalidPath,
573571

574-
error.DeviceBusy,
572+
// error.DeviceBusy,
575573
error.AccessDenied,
576574
error.SystemResources,
577575
error.NoDevice,

0 commit comments

Comments
 (0)