[processing] fix broken stdout handling in GRASS algs (fix #21142)

This commit is contained in:
Alexander Bruy 2019-01-31 15:52:43 +02:00
parent a911ef3367
commit b9f559ee04
4 changed files with 12 additions and 7 deletions

View File

@ -631,15 +631,13 @@ class Grass7Algorithm(QgsProcessingAlgorithm):
if outName in parameters and parameters[outName] is not None:
# for HTML reports, we need to redirect stdout
if out.defaultFileExtension().lower() == 'html':
command += ' > "{}"'.format(
self.parameterAsFileOutput(
parameters, outName, context)
)
command += ' {}=- > "{}"'.format(
outName,
self.parameterAsFileOutput(parameters, outName, context))
else:
command += ' {}="{}"'.format(
outName,
self.parameterAsFileOutput(
parameters, outName, context))
self.parameterAsFileOutput(parameters, outName, context))
# For folders destination
elif isinstance(out, QgsProcessingParameterFolderDestination):
# We need to add a unique temporary basename

View File

@ -10,5 +10,5 @@ QgsProcessingParameterNumber|threshold|Threshold for connecting centers to the n
*QgsProcessingParameterField|arc_backward_column|Arc backward direction cost column (number)|None|input|0|False|True
*QgsProcessingParameterBoolean|-g|Use geodesic calculation for longitude-latitude locations|False|True
QgsProcessingParameterVectorDestination|output|Network_Salesman
QgsProcessingParameterFileDestination|sequence|Output file holding node sequence|Html files (*.html)|report.html|True
QgsProcessingParameterFileDestination|sequence|Output file holding node sequence|CSV files (*.csv)|None|True

View File

@ -0,0 +1,4 @@
sequence;category;cost_to_next
1;1;0.000
2;2;0.000
3;3;0.000
1 sequence category cost_to_next
2 1 1 0.000
3 2 2 0.000
4 3 3 0.000

View File

@ -280,6 +280,9 @@ tests:
output:
name: expected/grass7/v_net_salesman.shp
type: vector
sequence:
name: expected/grass7/v_net_salesman_seq.csv
type: file
- algorithm: grass7:v.net.steiner
name: v.net.steiner