28 lines
901 B
Zig
28 lines
901 B
Zig
const sys = @import("sys");
|
|
const core = sys.core;
|
|
const std = @import("std");
|
|
|
|
test "testing threadrunner" {
|
|
var spec = core.SpecVariantMap.init(std.testing.allocator);
|
|
try spec.put("name", .{ .string = "test" });
|
|
defer spec.deinit();
|
|
|
|
try core.start_module(&spec, .{}, std.testing.allocator);
|
|
defer core.shutdown_module(std.testing.allocator);
|
|
|
|
try sys.start_module(&spec, .{}, std.testing.allocator);
|
|
defer sys.shutdown_module(std.testing.allocator);
|
|
|
|
const task = try sys.SubprocessTask.create(std.testing.allocator, &.{ "echo", "this is an echo: hello world\n" });
|
|
defer task.destroy();
|
|
|
|
std.debug.print("task1 finished\n", .{});
|
|
try task.run();
|
|
task.wait();
|
|
|
|
const task2 = try sys.runCommand(std.testing.allocator, &.{ "echo", "sup homies" }, null);
|
|
defer task2.destroy();
|
|
std.debug.print("task2 finished\n", .{});
|
|
task2.wait();
|
|
}
|