1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:07:44 +00:00

Shell: Separate fd rewirings from redirections.

This was unnecessarily confusing. When we build up a chain of commands
connected by pipes, we now store the file descriptors of each end of
these pipes as rewirings in a vector. The rewirings are then put into
effect by calls to dup2().
This commit is contained in:
Andreas Kling 2019-06-04 20:36:08 +02:00
parent 59dae9a766
commit 848044b74c
3 changed files with 19 additions and 18 deletions

View file

@ -10,7 +10,6 @@ struct Redirection {
FileWrite,
FileWriteAppend,
FileRead,
Rewire
};
Type type;
int fd { -1 };
@ -18,9 +17,15 @@ struct Redirection {
String path {};
};
struct Rewiring {
int fd { -1 };
int rewire_fd { -1 };
};
struct Subcommand {
Vector<String> args;
Vector<Redirection> redirections;
Vector<Rewiring> rewirings;
};
class Parser {