45 lines
1.4 KiB
Zig
45 lines
1.4 KiB
Zig
const std = @import("std");
|
|
pub const c = @import("c.zig").c;
|
|
|
|
pub const PropertiesID = u32;
|
|
|
|
pub const IOStream = opaque {};
|
|
|
|
pub const Process = opaque {
|
|
pub inline fn getProcessProperties(process: *Process) PropertiesID {
|
|
return c.SDL_GetProcessProperties(process);
|
|
}
|
|
|
|
pub inline fn readProcess(process: *Process, datasize: *usize, exitcode: *c_int) ?*anyopaque {
|
|
return c.SDL_ReadProcess(process, @ptrCast(datasize), @ptrCast(exitcode));
|
|
}
|
|
|
|
pub inline fn getProcessInput(process: *Process) ?*IOStream {
|
|
return c.SDL_GetProcessInput(process);
|
|
}
|
|
|
|
pub inline fn getProcessOutput(process: *Process) ?*IOStream {
|
|
return c.SDL_GetProcessOutput(process);
|
|
}
|
|
|
|
pub inline fn killProcess(process: *Process, force: bool) bool {
|
|
return c.SDL_KillProcess(process, force);
|
|
}
|
|
|
|
pub inline fn waitProcess(process: *Process, block: bool, exitcode: *c_int) bool {
|
|
return c.SDL_WaitProcess(process, block, @ptrCast(exitcode));
|
|
}
|
|
|
|
pub inline fn destroyProcess(process: *Process) void {
|
|
return c.SDL_DestroyProcess(process);
|
|
}
|
|
};
|
|
|
|
pub inline fn createProcess(args: [*c]const [*c]const u8, pipe_stdio: bool) ?*Process {
|
|
return c.SDL_CreateProcess(args, pipe_stdio);
|
|
}
|
|
|
|
pub inline fn createProcessWithProperties(props: PropertiesID) ?*Process {
|
|
return c.SDL_CreateProcessWithProperties(props);
|
|
}
|