Index: /trunk/src/org/openstreetmap/josm/tools/Utils.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 16051)
+++ /trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 16052)
@@ -922,16 +922,18 @@
             Logging.debug(String.join(" ", command));
         }
-        Path out = Files.createTempFile("josm_exec_", ".txt");
-        Process p = new ProcessBuilder(command).redirectErrorStream(true).redirectOutput(out.toFile()).start();
-        if (!p.waitFor(timeout, unit) || p.exitValue() != 0) {
-            throw new ExecutionException(command.toString(), null);
-        }
-        String msg = String.join("\n", Files.readAllLines(out)).trim();
+        Path out = Files.createTempFile("josm_exec_" + command.get(0) + "_", ".txt");
         try {
-            Files.delete(out);
-        } catch (IOException e) {
-            Logging.warn(e);
-        }
-        return msg;
+            Process p = new ProcessBuilder(command).redirectErrorStream(true).redirectOutput(out.toFile()).start();
+            if (!p.waitFor(timeout, unit) || p.exitValue() != 0) {
+                throw new ExecutionException(command.toString(), null);
+            }
+            return String.join("\n", Files.readAllLines(out)).trim();
+        } finally {
+            try {
+                Files.delete(out);
+            } catch (IOException e) {
+                Logging.warn(e);
+            }
+        }
     }
 
Index: /trunk/test/unit/org/openstreetmap/josm/tools/UtilsTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/tools/UtilsTest.java	(revision 16051)
+++ /trunk/test/unit/org/openstreetmap/josm/tools/UtilsTest.java	(revision 16052)
@@ -596,3 +596,13 @@
         assertEquals(map4, Utils.toUnmodifiableMap(map4));
     }
+
+    /**
+     * Test of {@link Utils#execOutput}
+     * @throws Exception if an error occurs
+     */
+    @Test
+    public void testExecOutput() throws Exception {
+        final String output = Utils.execOutput(Arrays.asList("echo", "Hello", "World"));
+        assertEquals("Hello World", output);
+    }
 }
