Repository navigation
Exit statuses follow Graphviz's dot: 2 for an unreadable input, 1 for a bad command line - #158
Merged
Merged
Conversation
… a bad command line
The command had statuses of its own: 1 for an input or rendering error, 2
for a usage error. Graphviz's dot, which the command stands in for, has
them the other way round, so a script that tells the two apart read each
for the other. Run beside dot 16.1.1:
Graphviz before now
a file that is not there 2 1 2
a file that may not be opened 2 1 2
an empty name (dot "") 2 (stdin) 2
an unknown flag (-Q) 1 2 1
an unknown format, an unknown layout 1 2 1
-T, -K or -o without its value 1 2 1
a directory as the input 0 1 2
two inputs (renders) 2 1
run now returns 2 when the input cannot be read and 1 for every other
failure; a command line it cannot take still gets the usage on standard
error. A parse error, a failed render, an output that cannot be written
and an error Graphviz reports while it draws were 1 and stay 1, as there.
An empty argument, which an unset variable gives a script, was taken for
no input at all and standard input was read. It is a name like another,
of a file that cannot be opened: the options record that an input was
named, apart from what the name is.
Two differences are kept on purpose and said in the README. A directory as the
input stays an error, now with the status of an input that cannot be read:
Graphviz's dot opens it, reads nothing, says nothing and exits 0, which
tells a caller that named the wrong path that all went well. "-" stays
standard input, which Graphviz's dot refuses as an unknown option: it
takes nothing away from what that command accepts.
TestFailuresExitAsGraphvizsDot holds each status that follows the
reference to the native dot when DOT_ORACLE names one (ten cases, each
run against dot 16.1.1 here, a graph waiting on standard input in each);
the table of TestExitStatusesAndStreams carries the new statuses, the
directory among them.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: closer-claudio <claudio@farcloser.world>
closer-claudio
enabled auto-merge
November 23, 2026 04:29
Contributor
Author
|
Reviewed at 798d34e |
apostasie
approved these changes
Nov 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Breaking: the exit statuses of a failure change. A script that tests for
2to detect a usage error, or1for a missing input, has to follow.The command had statuses of its own (1 for an input or rendering error, 2 for a usage error). Graphviz's
dot, which this command stands in for, has them the other way round. Run beside Graphviz's dot 16.1.1:dot "")-Q)-T,-Kor-owithout its valuerunreturns 2 when the input cannot be read and 1 for every other failure. A command line it cannot take still gets the usage on standard error. A parse error, a failed render, an output that cannot be written and an error Graphviz reports while it draws were 1 and stay 1, as with Graphviz'sdot.An empty argument, which an unset variable gives a script, was taken for no input at all. It is now a name like another, of a file that cannot be opened.
Two differences are kept on purpose, and the README now says them:
dotopens it, reads nothing, says nothing and exits 0, which tells a caller that named the wrong path that all went well.-stays standard input. Graphviz'sdotrefuses it as an unknown option, so accepting it takes nothing away.Tests:
TestFailuresExitAsGraphvizsDotholds each status that follows the reference, ten cases, and each is also run against the nativedotwhenDOT_ORACLEnames one (all ten pass against 16.1.1). The table ofTestExitStatusesAndStreamscarries the new statuses, the directory among them.FuzzInput's contract (0 or 1 for any bytes on standard input) is unchanged: 2 needs an input that cannot be read.Not here: the command still takes one input file where Graphviz's
dotrenders several. And an input that holds several graphs is rendered in part, a later syntax error exiting 0 where Graphviz'sdotexits 1: #159.