Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Close *all* file descriptors
- X-seq: zsh-users 27784
- From: Dominik Vogt <dominik.vogt@xxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: Close *all* file descriptors
- Date: Sun, 22 May 2022 20:49:53 +0100
- Archived-at: <https://zsh.org/users/27784>
- In-reply-to: <YoqMZqv4XiIqPP1n@gmx.de>
- List-id: <zsh-users.zsh.org>
- Mail-followup-to: zsh-users@xxxxxxx
- References: <CAMP9c5m72agiGTgWwpi6JGTOsTuH58MGtiG7gJ+n01ey_iXd3A@mail.gmail.com> <CAH+w=7ZD9eHt-+AdVanOJru7r0JqDnT+FYqE5LRor2wt_bS8Bw@mail.gmail.com> <CAMP9c5kJ-zf1-Kyj0Px6dcXA9usPx_jcHN+M=0Y_uPfMNnC=sQ@mail.gmail.com> <YoqMZqv4XiIqPP1n@gmx.de>
- Reply-to: dominik.vogt@xxxxxx
On Sun, May 22, 2022 at 08:17:58PM +0100, Dominik Vogt wrote:
> On Sun, May 22, 2022 at 05:49:50AM -0500, Zach Riggle wrote:
> > Unfortunately, macOS does not support proofs, so there???s no nice way to do
> > it the way you recommended.
> >
> > I can just force-close the first 1024 file descriptors that I don???t care
> > about, and hope that it???s sufficient.
>
> Does this help?
>
> $ for FD in $(lsof -p $$ |
> tr -s " " |
> cut -f 4 -d " " |
> grep "^[0-9]*[urw]$" |
> sed -e "s/[urw]$//"); do
> # close/redirect FD or whatever
> :
> done
Or simpler:
$ ... $(lsof -p $$ -F F | grep "^f[0-9]*$" | tr -d f) ...
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt
Messages sorted by:
Reverse Date,
Date,
Thread,
Author