19 lines
473 B
Plaintext
19 lines
473 B
Plaintext
const Error = error{
|
|
unexpected_result,
|
|
};
|
|
const std = #import("std");
|
|
|
|
const main = fn() Error!void {
|
|
if (std.os.duplicate_process()) |pid| {
|
|
if (pid == 0) {
|
|
std.print(bytes = "Hello from child\n");
|
|
std.os.exit(exit_code = 0);
|
|
} else {
|
|
std.print(bytes = "Hello from parent\n");
|
|
}
|
|
} else {
|
|
std.print(bytes = "Unable to create child process\n");
|
|
return Error.unexpected_result;
|
|
}
|
|
}
|