commit 10cf8c9d36e4d6cdc448fe36765cab9f66f6c724
parent 92e8ce06c1b01767c253c47ce1af9225bff4116f
Author: Pierre Curto <pierre.curto@gmail.com>
Date: Tue, 30 Aug 2022 18:28:45 +0200
os::exec: fix pipe documentation
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
Diffstat:
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/os/exec/exec+linux.ha b/os/exec/exec+linux.ha
@@ -36,13 +36,24 @@ export fn fork() (process | void | error) = {
// To capture the standard output of a process:
//
// let pipe = exec::pipe();
-// exec::addfile(&cmd, pipe.1, os::stdout_file);
+// exec::addfile(&cmd, os::stdout_file, pipe.1);
// let proc = exec::start(&cmd)!;
// io::close(pipe.1)!;
//
// let data = io::drain(pipe.0)!;
// io::close(pipe.0)!;
// exec::wait(&proc)!;
+//
+// To write to the standard input of a process:
+//
+// let pipe = exec::pipe();
+// exec::addfile(&cmd, os::stdin_file, pipe.0);
+// let proc = exec::start(&cmd)!;
+//
+// io::writeall(data)!;
+// io::close(pipe.1)!;
+// io::close(pipe.0)!;
+// exec::wait(&proc)!;
export fn pipe() (io::file, io::file) = {
return unix::pipe()!;
};