From 3c4f138bb9531a2bfe9b58b5f5a4876d7a04f36c Mon Sep 17 00:00:00 2001 From: Alexander van Amesfoort <amesfoort@astron.nl> Date: Mon, 27 Mar 2017 15:44:40 +0000 Subject: [PATCH] Task #9939: Cobalt getOutputProcHosts: fix trailing space. When coverted to a ',', 'srun -w' can still deal with it, but other parts of our shell scripts do not like it --- RTCP/Cobalt/GPUProc/src/getOutputProcHosts.cc | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/RTCP/Cobalt/GPUProc/src/getOutputProcHosts.cc b/RTCP/Cobalt/GPUProc/src/getOutputProcHosts.cc index 8be4a02b02f..18ef09001bb 100644 --- a/RTCP/Cobalt/GPUProc/src/getOutputProcHosts.cc +++ b/RTCP/Cobalt/GPUProc/src/getOutputProcHosts.cc @@ -71,12 +71,15 @@ int main(int argc, char **argv) Parset ps(argv[optind]); // Get the list of stations and output to stdout space separated - for (std::vector<string>::const_iterator host = ps.settings.outputProcHosts.begin(); - host != ps.settings.outputProcHosts.end(); - ++host) - { - cout << *host << " "; + std::vector<string>::const_iterator host = ps.settings.outputProcHosts.begin(); + if (host != ps.settings.outputProcHosts.end()) { + cout << *host; + ++host; + + for ( ; host != ps.settings.outputProcHosts.end(); ++host) { + cout << ' ' << *host; + } } return 0; - } +} -- GitLab