Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defer creation of dummy process until we actually have something to output (#1051) #1052

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading