Skip to content

[vcpkg-tool] Don't spread calls to abort around the codebase #27152

@Thomas1664

Description

@Thomas1664

Is your feature request related to a problem? Please describe.

The tool exits almost always if it hits an exceptional state by calling std::abort. This happens via calls to value_or_exit and alike. There are a few issues with exiting the program: Most importantly, no stack unwinding is done. This will lead to problems, especially in the context of multithreading. Therefore, we can almost never use multithreading and parallel algorithms to make vcpkg faster.

Proposed solution

  • Replace all calls to value_or_exit and alike that are outside a command's perform_and_exit either with throwing an exception, vcpkg::Optional, or ExpectedS/ ExpectedT.
  • Express in the function name that a function may exit on failure.

Describe alternatives you've considered

Don't use multithreading/ parallel algorithms at all. Especially parallel algorithms can lead to massive performance improvements. This way, vcpkg would be a lot slower than it could be.

Additional context

microsoft/vcpkg-tool#694 (comment)

CC: @ras0219-msft

Metadata

Metadata

Assignees

Labels

Stalecategory:vcpkg-featureThe issue is a new capability of the tool that doesn’t already exist and we haven’t committed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions