mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:37:35 +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:
parent
59dae9a766
commit
848044b74c
3 changed files with 19 additions and 18 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue