Unix shell 编程
我需要帮助编写 shell。我目前正在创建管道并生成关联的子进程以读取和写入管道。似乎不起作用的部分是父进程和子进程之间的通信。我需要这方面的帮助。首先,如果您能解释一下这是如何工作的(以及标准输入和标准输出),并帮助我剖析我所需要的内容以帮助我理解我所缺少的内容,我将不胜感激。
I am in need of help writing a shell please. I am currently in the process of creating pipes and spawning associated child process to read and write to the pipe. The part that does not seem to work is communication between the parent and the child process. I need help with this please. First off, I would appreciate it if you would please explain how this would work (Stdin and Stdout as well) and also help me dissect what I have to help me understand what I am missing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
总体情况是:
如果需要捕获子进程的输入、输出和错误,则需要三个管道和相应的 dup2 调用:
The general picture is:
If you need to capture input, output and error from a child process, you need three pipes and according dup2 calls: