nextcloud/server

`occ` output not quiet when it should be, exit code not proper

開放

#27,029 建立於 2021年5月19日

 (14 則留言) (0 個反應) (1 位負責人)PHP (4,865 個分叉)batch import
25-feedback3. to reviewbugfeature: occgood first issue

倉庫指標

星標
 (34,953 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

Steps to reproduce

  1. occ files:scan -- nonexistantuser
{"reqId":"gF4yvg4t66k03R7DWvY4","level":1,"time":"2021-05-19T09:45:18+00:00","remoteAddr":"","user":"--","app":"admin_audit","method":"","url":"--","message":"Console command executed: files:scan -- nonexistant","userAgent":"--","version":"19.0.8.1"}
Unknown user 1 nonexistant
+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 0       | 0     | 00:00:00     |
+---------+-------+--------------+
$ echo $?
0
  1. occ files:scan -q -- nonexistantuser
{"reqId":"cP30drfWr696XfVOnNs1","level":1,"time":"2021-05-19T09:47:12+00:00","remoteAddr":"","user":"--","app":"admin_audit","method":"","url":"--","message":"Console command executed: files:scan -q -- nonexistantuser","userAgent":"--","version":"19.0.8.1"}
  1. occ files:scan -q -- existinguser
{"reqId":"cP30drfWr696XfVOnNs1","level":1,"time":"2021-05-19T09:47:12+00:00","remoteAddr":"","user":"--","app":"admin_audit","method":"","url":"--","message":"Console command executed: files:scan -q -- existinguser","userAgent":"--","version":"19.0.8.1"}

Expected behaviour

  1. Less output (see 3. below), but most of all, an exit code indicating an error has occurred.
  2. I said quiet! Still I get (irrelevant, to me) output but the one that should actually be issued (there has been an error!) gets suppressed!
  3. The logfile details in JSON should generally not be shown. Silence is golden. Using this (and most likely other occ commands as well, this is a more general issue!) in cron jobs/scripts always leads to notifications. If there is no error, do not output anything. Especially not when asked to be quiet. There are verbose flags. If using them, output can be generated. Only output error messages to stderr (or maybe verbose messages, if asked to). Yes, I can redirect stderr to /dev/null but that's not sensible. I'd like to get notified if an actual error occurs!

Server configuration

Nextcloud version: 19.0.8.1

The rest is irrelevant.

貢獻者指南