@@ -56,7 +56,7 @@ public OpenCliExecutor(OpenCliProperties properties, OpenCliProcessRuntime proce
5656
5757 /** @param adapterAndRest command and literal values @return execution result */
5858 public OpenCliResult invoke (List <String > adapterAndRest ) {
59- return invokeInternal (adapterAndRest , new OpenCliCancellationToken (), false , false );
59+ return invokeInternal (adapterAndRest , new OpenCliCancellationToken (), false );
6060 }
6161
6262 /**
@@ -68,7 +68,7 @@ public OpenCliResult invoke(List<String> adapterAndRest) {
6868 * @return execution result
6969 */
7070 public OpenCliResult invoke (List <String > adapterAndRest , OpenCliCancellationToken cancellationToken ) {
71- return invokeInternal (adapterAndRest , Objects .requireNonNull (cancellationToken , "cancellationToken" ), true , false );
71+ return invokeInternal (adapterAndRest , Objects .requireNonNull (cancellationToken , "cancellationToken" ), true );
7272 }
7373
7474 /**
@@ -79,11 +79,14 @@ public OpenCliResult invoke(List<String> adapterAndRest, OpenCliCancellationToke
7979 * @throws UnsupportedOperationException when configured for legacy HTTP collect
8080 */
8181 public OpenCliResult invokeLocalOnly (List <String > argv ) {
82- return invokeInternal (argv , new OpenCliCancellationToken (), false , true );
82+ if (properties .getExecutionTarget () == OpenCliExecutionTarget .REMOTE_AGENT_HTTP ) {
83+ throw new UnsupportedOperationException ("This command requires local process execution" );
84+ }
85+ return invoke (argv );
8386 }
8487
8588 private OpenCliResult invokeInternal (List <String > adapterAndRest ,
86- OpenCliCancellationToken cancellationToken , boolean explicitCancellation , boolean localOnly ) {
89+ OpenCliCancellationToken cancellationToken , boolean explicitCancellation ) {
8790 long submittedAtNanos = System .nanoTime ();
8891 long timeoutMillis = properties .getCommandTimeoutMillis ();
8992 List <String > tokens = OpenCliArgSupport .snapshotValues (adapterAndRest , "adapterAndRest" );
@@ -94,9 +97,6 @@ private OpenCliResult invokeInternal(List<String> adapterAndRest,
9497 throw new IllegalArgumentException ("adapterAndRest[0] command identifier must not be blank" );
9598 }
9699 if (properties .getExecutionTarget () == OpenCliExecutionTarget .REMOTE_AGENT_HTTP ) {
97- if (localOnly ) {
98- throw new UnsupportedOperationException ("This command requires local process execution" );
99- }
100100 if (explicitCancellation ) {
101101 throw new UnsupportedOperationException ("Explicit process cancellation is local-only for legacy collect" );
102102 }
0 commit comments