String runCommandExpectSingleID()

in containers-docker-local/src/main/java/org/apache/aries/containers/docker/local/impl/LocalDockerController.java [75:93]


    String runCommandExpectSingleID(String ... command) throws IOException {
        String res = runCommand(command);
        if (res != null) {
            res = res.trim();
            String lastLine = res;
            try (BufferedReader lnr = new BufferedReader(new StringReader(res))) {
                String line;
                while ((line = lnr.readLine()) != null) {
                    lastLine = line;
                }
            }
            if (lastLine.indexOf(' ') != -1 ) {
                 throw new IOException("Unable to execute docker command: " + res);
            }
            res = lastLine;
        }

        return res;
    }