BashSupport-Pro / bashsupport-pro

Public issue tracking for BashSupport Pro. This is a plugin, which provides advanced support for Bash scripts for JetBrains IDEs.
https://www.bashsupport.com
46 stars 2 forks source link

Support dynamic file descriptor variables #171

Open chrko opened 2 months ago

chrko commented 2 months ago

I had the need to just get the next free FD for a flock call, and the following is actually a thing you can do (cmp. https://stackoverflow.com/a/41620630):

exec {flock_fd}>"${flock_file}"
flock "${flock_fd}"
# […]
exec {flock_fd}>&-

Currently the plugin marks the usage of the variable flock_fd as "referenced but not assigned".

jansorg commented 2 months ago

Thanks for reporting! That's a tough one. Currently, named file descriptors are not supported as it's neither a variable or function. I hope to provide better support with the next major version (5.x).

chrko commented 2 months ago

👍 I think it’s a niche feature, so from my side no urgency or priority. Actually only wanted to do this to not gamble with possible already used fds in bats.