Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Display shell help message with `out` instead of `err` when missing method #11179
When i run
I discovered the same the last days.
@@ Coverage Diff @@ ## master #11179 +/- ## ============================================ + Coverage 93.15% 93.15% +<.01% - Complexity 12978 12979 +1 ============================================ Files 437 437 Lines 33619 33622 +3 ============================================ + Hits 31317 31320 +3 Misses 2302 2302
Sep 13, 2017
5 checks passed
I don't think this change is correct; when usage (help) output is printed due to missing arguments on Linux, that output should be send to stdErr to prevent the output from being piped to other commands when redirecting output.
I did a quick search to provide more information, and found this; https://www.jstorimer.com/blogs/workingwithcode/7766119-when-to-use-stderr-instead-of-stdout, but there should be other resources explaining this
I too disagree with this change.
I think a better solution is:
diff --git a/src/Console/Shell.php b/src/Console/Shell.php index d513038..8bd52aa 100644 --- a/src/Console/Shell.php +++ b/src/Console/Shell.php @@ -508,7 +508,7 @@ class Shell return $this->main(...$this->args); } - $this->err($this->OptionParser->help($command)); + $this->_io->err($this->OptionParser->help($command)); return false; }
This also correctly handles the