Varnishadm: Add -e argument
-e Exit immediately if a command fails in
passmode and return the CLI status code of the failing command. This has no effect oninteractivemode (except when-pis used). Similarly toCLI Command File(see :ref:varnishd(1)), if a command is prefixed with '-', its failure will be ignored and will not cause varnishadm to exit.
Fixes: #4012
Bugwash:
[15:09:38] <phk> I dont see any problems [15:09:49] <phk> but I guess we should give @nigoroll a chance
I am not sure if what I am asking for justifies the effort, but I am having a hard time following the first commit. If it is not too much work, could it be split into smaller commits or could the commit message explain better what it does?
If it is not too much work, could it be split into smaller commits or could the commit message explain better what it does?
Not sure how the github web UI would render it, but if the discarded comment was preserved as I suggested we would likely have a cleaner diff.
I brought back the comment mentioned by Dridi, hopefully this will make the diff a bit more readable. Otherwise, I don't see any way to break the commit into smaller ones.
- Changed the return value of
varnishadm -etocli status / 100after phk's suggestion during bugwash. That is because CLI status can go beyond 255 and we might have a status code that is N*256 that will return 0. - Added polling to the remote cli socket so that we are notified if the socket hangs up when we are not writing anything.
- Added quoting to the CLI command arguments so that the VCLS server we are forwarding commands to sees the arguments grouped in the same way they were received.
Note that tests will not pass until the bugfix in f354ca99f133fb501d01849ca8a111981c15fb84 is merged.
Addressed dridi's comments:
- Harmonized the exit status and documented them in EXIT STATUS section of the man page.
- We don't forward the parsed heredoc now, we reconstruct it and forward it to be parsed in mgt instead.
Ready for review