-
Notifications
You must be signed in to change notification settings - Fork 282
Description
E.g.
$ ./peports no-such-file; echo $?
peports: could not load file: no-such-file
0
It should exit with an error code instead.
Same, apparently, on other errors, for instance:
$ ./peports -i peports.c; echo $?
peports: unexpected end of input (slice): peports.c
0
Unrelated, while it pretends to parse standard options, it's not exactly POSIX getopt
, for instance it doesn't understand --
to mark end-of-options, as in ./peports -i -- file.exe
, and instead interprets it as an unknown options: peports: unknown option: --
(it does exit with an error code in this case, but incorrectly so).
The options parser also quietly skips -
arguments, as in ./peports - < file.exe
. This happens to work with one arg, because it ends up with no operands, which then uses fakeargv - which adds -
, but it does not work correctly in other use cases, e.g. ./peports - file.exe
, which is expected to first process stdin, then file.exe, but stdin is not processed because -
is skipped.
Both issues would not happen with standard getopt
or other compliant options parser, the former because the parser will eat the --
and then stop, and the latter because -
is considered not-option (i.e. first-operand).