git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] builtins + test helpers: use return instead of exit() in cmd_*

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 9, 2021, 03:38 UTC
Message-ID
<xmqqy2bjlnbw.fsf@gitster.g>
In-Reply-To
<87im2n3gje.fsf@evledraar.gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
> So it's really the opposite of what you're saying. If you have cleanups
> that are truly important, i.e. so important that you'd like to notify
> the user with a non-zero exit code if they fail, you *don't* want them
> in an atexit handler. That won't work.

Ah, OK. What I had in mind was things like removing the directory "clone" attempted to create and populate, removing temporary files, etc. when a function that is not marked as NORETURN calls die(), by the atexit handler. But you're right. We leave a final clean-up for normal returns (i.e. when cmd_foo() intends to return or exit with 0) to be done to the caller that is git.::run_builtin().

Thanks.
Previous: Ævar Arnfjörð Bjarmason
Message 10 of 10 in “builtins + test helpers: use return instead of exit() in cmd_*”
  1. builtins + test helpers: use return instead of exit() in cmd_*Ævar Arnfjörð Bjarmason, Jun 7, 2021
  2. Felipe ContrerasJun 7, 2021
  3. Jeff KingJun 8, 2021
  4. Ævar Arnfjörð BjarmasonJun 8, 2021
  5. Phillip WoodJun 10, 2021
  6. Ævar Arnfjörð BjarmasonJun 10, 2021
  7. builtins + test helpers: use return instead of exit() in cmd_*Ævar Arnfjörð Bjarmason, Jun 8, 2021
  8. Junio C HamanoJun 8, 2021
  9. Ævar Arnfjörð BjarmasonJun 9, 2021
  10. Junio C HamanoJun 9, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.