我试图在VS Code的输出窗口中显示我的Rust程序的标准输出。现在输出转到外部命令shell。我可以用 @Test
public void apiUsersCode( ) {
apiMethodThatReturnsCloudflareInfos( new FutureCallback<String>() {
@Override
public void onSuccess( @Nullable String result ) {
System.out.println( "WORKING" );
}
@Override
public void onFailure( Throwable t ) {
System.out.println( t );
}
} );
try {
new CountDownLatch( 1 ).await(2000, TimeUnit.MILLISECONDS);
} catch ( InterruptedException e ) {
e.printStackTrace();
}
}
public static void apiMethodThatReturnsCloudflareInfos( FutureCallback<String> usersFutureCallback ) {
Callable<String> solution = ( ) -> {
Thread.sleep( 1000L ); // simulate slowness of next line
return "http output"; // this is this other method that sends a http request
};
// runs callable async, when done: execute usersFutureCallback
ExecutorService executor = Executors.newFixedThreadPool( 10 );
ListeningExecutorService service = MoreExecutors.listeningDecorator( executor );
ListenableFuture<String> listenableFuture = service.submit( solution );
Futures.addCallback( listenableFuture, usersFutureCallback, service );
}
以某种方式做到吗? OutputDebugString
用户设置似乎没有做任何事情。