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.

贡献者指南