| Summary: | --help returns an error code | ||
|---|---|---|---|
| Product: | Busybox | Reporter: | Tim Marston <ra00103> |
| Component: | Standard Compliance | Assignee: | unassigned |
| Status: | RESOLVED FIXED | ||
| Severity: | minor | CC: | busybox-cvs |
| Priority: | P5 | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Host: | Target: | ||
| Build: | |||
|
Description
Tim Marston
2012-10-19 15:47:46 UTC
CMD --help is intended to be run by user, not by script. Scripts typically have not enough AI to use the output :) Do you really rely on CMD --help's exit code? OK, that's a good point. I was trying to determine, in a Makefile, whether stty accepts a '-F' argument (GNU, busybox) or '-f' argument (BSD/OSX). The test I had been doing was to assume that if the command supported --help (i.e., GNU long options), it would also support -F: stty --help > /dev/null 2>&1 && echo -F || echo -f But this doesn't work for busybox. So I now using a test that defaults to -F unless I can detect an explicit and specific error message from --help: stty --help 2>&1 | grep -q 'illegal option' && echo -f || echo -F I realise these are both horrible and entirely unsupported ways of determining command line arguments, but I couldn't think of a nice way that would be suitable for use in a Makefile. With regard to the exit code of --help, I still think that it would be nice if busybox returned 0, if only for consistency. But I accept your point entirely. Fixed in git: commit efd0698f74caab0a0c8a51228b923ee142e8e278 Author: Denys Vlasenko <vda.linux@googlemail.com> Date: Thu Feb 28 12:34:18 2013 +0100 make --help return exitcode 0. Closes 5612 |