Skip to content

Commit 56398f7

Browse files
committed
Use better way of detecting synthetic "result" ouput
Signed-off-by: Squareys <[email protected]>
1 parent 4e0736e commit 56398f7

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

org.knime.scijava.commands/src/org/knime/scijava/commands/module/DefaultNodeModule.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.scijava.module.process.PreprocessorPlugin;
2525
import org.scijava.plugin.Parameter;
2626
import org.scijava.plugin.PluginService;
27+
import org.scijava.script.ScriptInfo;
2728

2829
/**
2930
* Default implementation of {@link NodeModule}.
@@ -175,11 +176,14 @@ public NodeModuleOutputChangedListener(final boolean manualPush) {
175176
public void notifyListener() throws Exception {
176177
// output can be null if sink node
177178
if (output != null) {
179+
final boolean hasSyntheticResult = info instanceof ScriptInfo &&
180+
((ScriptInfo) info).isReturnValueAppended();
181+
178182
final List<DataCell> cells = new ArrayList<DataCell>();
179183
for (final ModuleItem<?> entry : module.getInfo().outputs()) {
180184
// FIXME hack because e.g. python script contains
181185
// result log
182-
if (!entry.getName().equals("result")) {
186+
if (!hasSyntheticResult || !entry.getName().equals("result")) {
183187
cells.add(cs.convertToKnime(
184188
module.getOutput(entry.getName()),
185189
entry.getType(), outputMapping.get(entry),

org.knime.scijava.commands/src/org/knime/scijava/commands/module/DefaultNodeModuleService.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.scijava.module.ModuleService;
2626
import org.scijava.plugin.Parameter;
2727
import org.scijava.plugin.Plugin;
28+
import org.scijava.script.ScriptInfo;
2829
import org.scijava.service.AbstractService;
2930

3031
/**
@@ -100,12 +101,12 @@ public DataTableSpec createOutSpec(final ModuleInfo info,
100101
nameGen = new UniqueNameGenerator(new HashSet<>());
101102
}
102103

103-
// TODO (What?)... What?
104104
final List<DataColumnSpec> tableSpecs = new ArrayList<>();
105105

106-
// FIXME (result)
106+
final boolean hasSyntheticResult = info instanceof ScriptInfo &&
107+
((ScriptInfo) info).isReturnValueAppended();
107108
for (final ModuleItem<?> item : info.outputs()) {
108-
if (item.getName().equals("result")) {
109+
if (!hasSyntheticResult && item.getName().equals("result")) {
109110
continue;
110111
}
111112
tableSpecs.add(

0 commit comments

Comments
 (0)