ctubbsii commented on issue #185: Calling uno within a script fails URL: https://github.com/apache/fluo-uno/issues/185#issuecomment-406491058 Unless rewritten, the built-in initial file descriptors, `0`, `1`, and `2`, all point to the same console device by default. You may be able to create additional ones which also point to the same device. Using `0` is not necessarily any different (or more buggy) than using any other file descriptor aliased to that same device. The tricky part is finding one that isn't going to be messed with (rewritten) by other things during routine use. Here are reasons why `fd/0` was suitable: 1. Like `1` and `2`, it exists by default, 1. It may not always be possible to create new ones (might depend on platform or permissions or system limits), 1. Creating new file descriptors may require adding complexity to ensure the new ones are cleaned up when no longer needed, even in the case of failure, 1. `0` is rarely, if ever, rewritten by `>`, and thus expected to always point to the console, and 1. The pipe `|` does rewrite `fd/0` routinely, but since the uno script doesn't take any input, there wasn't any reason to expect that anybody would rewrite `fd/0` with a pipe. Using a different arbitrary one, like `5` is perfectly fine, as long as: 1. You don't expect anybody else to rewrite it, 1. You clean it up when done with it, 1. You assume the user can arbitrarily create new file descriptors wherever the script is executed, and 1. You accept the limitation that whatever number you choose isn't in use/rewritten by the caller (like `fd/0` was when the caller used a pipe). It may be simpler to just avoid rewriting `fd/0` by taking the uno script outside of a loop with a pipe involved, though, and accept that limitation. Either way works for me, but hopefully you understand the issue in greater detail now. :smiley_cat:
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
