Skip to content

Commit

Permalink
Defer creation of dummy process until we actually have something to o…
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianKroiss authored Aug 14, 2024
1 parent a240416 commit a1d06f6
Showing 1 changed file with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -618,26 +618,25 @@ private CompletableFuture<?> triggerUpdateThreads() {

@Override
public void output(OutputEventArguments args) {
boolean outputted = false;
DSPStreamsProxy dspStreamsProxy;
if (process == null) {
process(null); // create dummy process to have a console
}
dspStreamsProxy = process.getStreamsProxy();
String output = args.getOutput();
if (args.getCategory() == null || OutputEventArgumentsCategory.CONSOLE.equals(args.getCategory())
if (args.getCategory() == null //
|| OutputEventArgumentsCategory.CONSOLE.equals(args.getCategory()) //
|| OutputEventArgumentsCategory.STDOUT.equals(args.getCategory())) {
// TODO put this data in a different region with a different colour
dspStreamsProxy.getOutputStreamMonitor().append(output);
outputted = true;
getOrCreateStreamsProxy().getOutputStreamMonitor().append(output);
} else if (OutputEventArgumentsCategory.STDERR.equals(args.getCategory())) {
dspStreamsProxy.getErrorStreamMonitor().append(output);
outputted = true;
}
if (!outputted && DSPPlugin.DEBUG) {
getOrCreateStreamsProxy().getErrorStreamMonitor().append(output);
} else if (DSPPlugin.DEBUG) {
System.out.println("output: " + args);
}
}

private DSPStreamsProxy getOrCreateStreamsProxy() {
if (process == null) {
// create dummy process to have a console
process(null);
}
return process.getStreamsProxy();
}

@Override
Expand Down

0 comments on commit a1d06f6

Please sign in to comment.