Page MenuHomePhabricator

Add a mode to "ExecFuture" that makes "resolvex()" semantics the default
ClosedPublic

Authored by epriestley on Apr 11 2020, 10:38 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jun 8, 12:05 AM
Unknown Object (File)
Sun, Jun 5, 4:02 AM
Subscribers
None

Details

Summary

Ref T13490. "ExecFuture" can raise a "CommandException" when the subprocess fails. In most cases, this is desirable, since we usually do not expect subprocesses to fail.

Currently, "execx()" (which raises these exceptions) is the synchronous default (with the more verbose "exec_manual()" as an alternative if you expect the command may return an error code), but the Future variation has no way to hint that external resolution should raise an exception if the process exits with an error.

Since the "HardpointEngine" yield construct can resolve external futures, add a mode for this to simplify implementing "HardpointQuery" classes a bit. Without this, they either need to retain "$futures" and manually call "resolvex()", or check the "$err" result and throw some other exception, both of which are low-value boilerplate (queries that want to do this still can, of course).

This is basically like providing a hint that the futures should be resolved with "resolvex()" instead of "resolve()".

Also, make this the default behavior of a new "$api->newFuture()" wrapper.

Test Plan

Intentionally broke a command in a HardpointQuery, got a sensible exception automatically during external future resolution.

Diff Detail

Repository
rARC Arcanist
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

  • Cherry-pick "newFuture()" back from a future change.
This revision was not accepted when it landed; it landed in state Needs Review.Apr 12 2020, 8:18 PM
This revision was automatically updated to reflect the committed changes.