문제

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.)

도움이 되었습니까?

해결책

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}>&-
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top