Skip to content
This repository was archived by the owner on Nov 10, 2023. It is now read-only.

Commit 50ee936

Browse files
swgillespiefacebook-github-bot
authored andcommitted
Unwrap all process delegates instead of only the first one
Summary: Prior to the advent of ResourceMonitoringProcesseExecutor, there was only one other delegate launched process executor - the executor responsible for launching processes using the Downward API. Now, it's possible to have three levels of delegation for process executors: a Downward API executor can delegate to a ResourceMonitoringProcessExecutor, which in turn delegates to a DefaultProcessExecutor. DefaultProcessExecutor unwraps delegate launched processes in order to find its impl class (since it expects to be the last entry in the delegate chain), but it was previously only unwrapping delegates one time, which does not work when the delegate chain is longer than two delegates long. This commit switches the if to a while, which walks the full delegate chain to find the impl class at the end. Reviewed By: mykola-semko fbshipit-source-id: 521afab2ae4efc7e8653423d0a9bb73a5366ae70
1 parent 2ea9861 commit 50ee936

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/com/facebook/buck/util/DefaultProcessExecutor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,8 @@ public void close() {
401401

402402
private LaunchedProcessImpl getLaunchedProcessImpl(LaunchedProcess launchedProcess) {
403403
LaunchedProcess process = launchedProcess;
404-
if (launchedProcess instanceof DelegateLaunchedProcess) {
405-
DelegateLaunchedProcess delegateLaunchedProcess = (DelegateLaunchedProcess) launchedProcess;
404+
while (process instanceof DelegateLaunchedProcess) {
405+
DelegateLaunchedProcess delegateLaunchedProcess = (DelegateLaunchedProcess) process;
406406
process = delegateLaunchedProcess.getDelegate();
407407
}
408408

0 commit comments

Comments
 (0)