magicant / yash-rs

Reimplementation of yash, an extended POSIX shell
67 stars 3 forks source link

Implementing shell environment #5

Open magicant opened 3 years ago

magicant commented 3 years ago

This is a tracking issue for implementation of shell environment.

Items

Items marked * are defined in POSIX.

Possible optimizations

magicant commented 3 years ago

It may be helpful to have a set of internally used file descriptors as one of application-managed attributes. Such FDs can be redirections' saved FD, pipes for sending here-document contents, interactive shell's tty, etc. Such FDs are invisible from the user, so they must move to other unused FDs when the user performs redirections on them. We can use Rc<Cell<Fd>> to keep track of where these FDs moved.

magicant commented 1 year ago

The CLOEXEC flag indicates whether an FD is internal, so we don't necessarily need an FD set. We don't have to think about FDs moving as long as we don't support overwriting internal FDs.