Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Close *all* file descriptors
- X-seq: zsh-users 27783
- From: Dominik Vogt <dominik.vogt@xxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: Close *all* file descriptors
- Date: Sun, 22 May 2022 20:17:58 +0100
- Archived-at: <https://zsh.org/users/27783>
- In-reply-to: <CAMP9c5kJ-zf1-Kyj0Px6dcXA9usPx_jcHN+M=0Y_uPfMNnC=sQ@mail.gmail.com>
- 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>
- Reply-to: dominik.vogt@xxxxxx
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
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt
Messages sorted by:
Reverse Date,
Date,
Thread,
Author