ProcessUtil(FileUtil fileUtil, String pid, PrintStream out, PrintStream err, Str str, Shell.Factory shellFactory, Streams streams, Threads threads) { this.pid = (pid != null) ? pid.trim() : "-1"; this.out = out; this.err = err; this.fileUtil = fileUtil; this.str = str; this.shellFactory = shellFactory; this.streams = streams; this.threads = threads; if (fileUtil.isWindows()) { this.killCommand = getWindowsKillFile().getPath(); } else { this.killCommand = "kill"; } }
/** * On UNIX systems, in order for a file to be executable, it needs to have * the execute bit set. This method executes a "chmod +x filename" */ public void addExecutableRights(File executable, PrintStream out, PrintStream err) { if (isWindows()) { return; } String[] args = { "chmod", "+x", executable.getPath() }; String tName = "make " + executable + " runable"; shellFactory.newShell(args, tName, out, err).run(); }