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, Apr 11, 7:41 AM
Unknown Object (File)
Sat, Apr 6, 7:23 AM
Unknown Object (File)
Mar 4 2024, 3:05 AM
Unknown Object (File)
Feb 17 2024, 1:44 AM
Unknown Object (File)
Jan 12 2024, 8:51 PM
Unknown Object (File)
Jan 9 2024, 9:58 AM
Unknown Object (File)
Jan 9 2024, 8:17 AM
Unknown Object (File)
Jan 9 2024, 8:16 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 24050
Build 33108: Run Core Tests
Build 33107: 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.