Deutsch English Français Italiano |
<v010te$3q01h$2@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Rich <rich@example.invalid> Newsgroups: comp.os.linux.misc Subject: Re: Files tree Date: Sat, 20 Apr 2024 18:18:22 -0000 (UTC) Organization: A noiseless patient Spider Lines: 30 Message-ID: <v010te$3q01h$2@dont-email.me> References: <uvba27$2c40q$1@dont-email.me> <uvbfhm$2d8f0$1@dont-email.me> <v00mlg$3nvjj$1@dont-email.me> Injection-Date: Sat, 20 Apr 2024 20:18:22 +0200 (CEST) Injection-Info: dont-email.me; posting-host="1a7d45c2e70b613b81d13564d7372d2c"; logging-data="3997745"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+n2sHv1I2DoaV0QTNsF3y2" User-Agent: tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.139 (x86_64)) Cancel-Lock: sha1:3TFnwFj8FSvae8YQeq9P2nexCE8= Bytes: 2197 James Harris <james.harris.1@gmail.com> wrote: > I am trying to do the zero termination just now but have run in to a > problem. The above find command may report errors such as permission > failures and missing files. I really should include such info in the > output but coming from stderr such lines are newline- rather than > nul-terminated and therefore cannot be combined with just 2>&1. > > To get around that I tried > > find 2> >(tr '\n' '\0') > Since 'errors' are not "filenames" but rather "information about problems" (likely problems you'd want to investigate), don't try to zero terminate them and include them in the "filename list". Instead write the error stream to a separate file: find 2> error-stream And check the size of the "error-stream" (substitute your own name, or a temporary name for "error-stream") file when the process is finished. If the "error-stream" file is zero bytes, no issues occurred (well, none that 'find' reported). You can continue with the rest of what your process is doing, and remove the empty 'error-stream' file. If the "error-stream" file is non-zero, save it somewhere that you can find it (and relate it to which run it was for) and raise alarm bells to yourself to investigate what caused the error(s).