Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
fixed exec start command where a path contains spaces
Michael Peter Christenab3ef87abf19
diff --git a/source/net/yacy/cora/util/Html2Image.java b/source/net/yacy/cora/util/Html2Image.javaindex 8e437a2fb..10bea0e2b 100644--- a/source/net/yacy/cora/util/Html2Image.java+++ b/source/net/yacy/cora/util/Html2Image.java@@ -370,7 +370,15 @@ public class Html2Image {// i.e. convert -density 300 -trim yacy.pdf[0] -trim -resize 1024x -crop x1024+0+0 -quality 75% yacy-convert-300.jpg// note: both -trim are necessary, otherwise it is trimmed only on one side. The [0] selects the first page of the pdffinal String command = convertCmd + " -alpha remove -density " + density + " -trim " + pdf.getAbsolutePath() + "[0] -trim -resize " + width + "x -crop x" + height + "+0+0 -quality " + quality + "% " + image.getAbsolutePath();- List<String> message = OS.execSynchronous(command);+ List<String> message = OS.execSynchronous(new String[] {+ convertCmd,+ "-alpha", "remove", "-density", Integer.toString(density),+ "-trim", pdf.getAbsolutePath() + "[0]", "-trim",+ "-resize" + Integer.toString(width) + "x",+ "-crop x" + Integer.toString(height) + "+0+0",+ "-quality", Integer.toString(quality) + "%",+ image.getAbsolutePath()+ });if (image.exists()) return true;ConcurrentLog.warn("Html2Image", "failed to create image with command: " + command);for (final String m: message) ConcurrentLog.warn("Html2Image", ">> " + m);diff --git a/source/net/yacy/kelondro/logging/ThreadDump.java b/source/net/yacy/kelondro/logging/ThreadDump.javaindex 6233e0b21..a4d842d02 100644--- a/source/net/yacy/kelondro/logging/ThreadDump.java+++ b/source/net/yacy/kelondro/logging/ThreadDump.java@@ -137,7 +137,7 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> impfinal int pid = OS.getPID();// call kill -3 (SIGQUIT) on the pid to request a core dump from the current process- if (pid >= 0) try {OS.execSynchronous("kill -3 " + pid);} catch (final IOException e) {}+ if (pid >= 0) try {OS.execSynchronous(new String[]{"kill", "-3", Integer.toString(pid)});} catch (final IOException e) {}}// read the log from the dumpdiff --git a/source/net/yacy/kelondro/util/OS.java b/source/net/yacy/kelondro/util/OS.javaindex abf7d1695..7ca735e45 100644--- a/source/net/yacy/kelondro/util/OS.java+++ b/source/net/yacy/kelondro/util/OS.java@@ -118,7 +118,6 @@ public final class OS {return s;}- @SuppressWarnings("deprecation")public static void deployScript(final File scriptFile, final String theScript) throws IOException {FileUtils.copy(UTF8.getBytes(theScript), scriptFile);if(!isWindows){ // set executable@@ -141,7 +140,6 @@ public final class OS {return p >= 0 ? NumberTools.parseIntDecSubstring(pids, 0, p) : -1;}- @SuppressWarnings("deprecation")public static void execAsynchronous(final File scriptFile) throws IOException {// runs a script as separate threadString starterFileExtension = null;@@ -164,15 +162,6 @@ public final class OS {FileUtils.deletedelete(starterFile);}- @SuppressWarnings("deprecation")- public static List<String> execSynchronous(final String command) throws IOException {- // runs a unix/linux command and returns output as Vector of Strings- // this method blocks until the command is executed- final Process p = Runtime.getRuntime().exec(command);- return readStreams(p);- }-- @SuppressWarnings("deprecation")public static List<String> execSynchronous(final String[] command) throws IOException {// runs a unix/linux command and returns output as Vector of Strings// this method blocks until the command is executed@@ -212,14 +201,15 @@ public final class OS {public static void main(final String[] args) {try {- final List<String> v = execSynchronous("/usr/local/bin/wkhtmltoimage");+ final List<String> v = execSynchronous(new String[]{"/usr/local/bin/wkhtmltoimage"});for (final String r: v) java.lang.System.out.println(r);} catch (final IOException e) {+ e.printStackTrace();}/*- if (args[0].equals("-m")) {- java.lang.System.out.println("Maximum possible memory: " + Integer.toString(getWin32MaxHeap()) + "m");- }+ if (args[0].equals("-m")) {+ java.lang.System.out.println("Maximum possible memory: " + Integer.toString(getWin32MaxHeap()) + "m");+ }*/}