Question

I've done:

% zmodload zsh/net/socket
% zsocket -d 20 MY_SOCKET
# used the socket a bit

Now how do I close the socket's FD? (FD 20 here.)

Was it helpful?

Solution

Here's a mailing list post about zsocket:

As far as I can see there's no way of closing the file descriptors using zsocket, which seems an omission. Presumably you can use "exec 3>&-" etc. although to close a file descriptor over 9 you need to do something like:

      % fd=11
      % exec {fd}>&-

I don't know exactly what exec &- does, but you could try:

fd=20
exec {fd}>&-
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top