A Unix pipe emulator using
fork,execve, andpipe.
pipex is a 42 School project that recreates shell-like piping between commands. It simulates the behavior of:
< file1 cmd1 | cmd2 > file2The program replicates this using system-level calls like fork, execve, pipe, and file I/O redirection. It helps build a deep understanding of Unix internals, process management, and inter-process communication.
- Executes two commands connected via a pipe
- Supports input/output file redirection
- Uses only low-level system calls (no
popenorsystem()) - Handles error reporting and command path resolution
./pipex infile "cmd1" "cmd2" outfile./pipex input.txt "grep hello" "wc -l" output.txtWhich behaves like:
< input.txt grep hello | wc -l > output.txt- Only allowed to use:
open,close,read,write,malloc,free,access,dup,dup2,execve,exit,fork,pipe,unlink,wait,waitpid,perror,strerror - No
system()orpopen()calls
- π§΅ Inter-Process Communication (IPC) using pipes
- 𧬠Process management: creating child processes with
fork() - πͺ File descriptor redirection using
dup2() - π§ Command execution with
execve()and path resolution - ποΈ File I/O operations (
open,read,write,close) - π Error handling and custom message reporting
- π Environment parsing and working with
PATH - β»οΈ Memory management and resource cleanup
- βοΈ Debugging complex flows involving multiple processes