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)
Thu, Dec 12, 2:53 PM
Unknown Object (File)
Mon, Dec 9, 4:57 AM
Unknown Object (File)
Thu, Dec 5, 2:10 PM
Unknown Object (File)
Thu, Dec 5, 11:21 AM
Unknown Object (File)
Sun, Dec 1, 6:55 AM
Unknown Object (File)
Thu, Nov 28, 1:07 PM
Unknown Object (File)
Wed, Nov 27, 6:53 AM
Unknown Object (File)
Nov 23 2024, 11:15 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
Branch
aflow4
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 24049
Build 33106: Run Core Tests
Build 33105: arc lint + arc unit

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.