private Shell launchShell(String threadName, String[] args, int seconds) { Shell shell = shellFactory.newShell(args, threadName, out, err); shell.start(); int fraction = 20; int loops = (fraction * seconds); do { threads.pause((1000/fraction)); } while(!shell.hasReturned() && loops-- > 0); if (!shell.hasReturned()) { err.println("Thread \"" +threadName + "\" may be hung"); err.println("(did not return after " + seconds + " seconds)"); err.println("command line used: "); err.println(str.toString(Arrays.asList(args), "", " ", "")); } return shell; }
/** called from option parser as well */ synchronized Shell exec(String threadName, Map mysqldArgs, PrintStream outStream, PrintStream errStream, boolean withListeners) { mysqldArgs.put(MysqldResourceI.BASEDIR, baseDir.getPath()); mysqldArgs.put(MysqldResourceI.PID_FILE, pidFile().getPath()); socket(mysqldArgs); File dataDir = dataDir(mysqldArgs); makeMysqld(); ensureEssentialFilesExist(dataDir); String[] args = constructArgs(mysqldArgs); outStream.println(str.toString(args)); Shell launch = shellFactory.newShell(args, threadName, outStream, errStream); if (withListeners) { for (int i = 0; i < completionListensers.size(); i++) { Runnable listener = (Runnable) completionListensers.get(i); launch.addCompletionListener(listener); } } launch.setDaemon(true); printMessage("launching mysqld (" + threadName + ")"); launch.start(); return launch; }
private Shell launchShell(String threadName, String[] args, int seconds) { Shell shell = utils.shellFactory().newShell(args, threadName, out, err); shell.start(); int fraction = 20; int loops = (fraction * seconds); do { utils.threads().pause((1000 / fraction)); } while (!shell.hasReturned() && loops-- > 0); if (!shell.hasReturned()) { err.println("Thread \"" + threadName + "\" may be hung"); err.println("(did not return after " + seconds + " seconds)"); err.println("command line used: "); err.println(new ListToString("", " ", "").toString(args)); } return shell; }
private Shell exec(String threadName, Map mysqldArgs, PrintStream outStream, PrintStream errStream, boolean withListeners) { makeMysqld(); ensureEssentialFilesExist(); adjustParameterMap(mysqldArgs); String[] args = constructArgs(mysqldArgs); outStream.println(new ListToString().toString(args)); log.info("starting mysqld: " + new ListToString().toString(args)); Shell launch = utils.shellFactory().newShell(args, threadName, outStream, errStream); if (withListeners) { for (int i = 0; i < completionListensers.size(); i++) { Runnable listener = (Runnable) completionListensers.get(i); launch.addCompletionListener(listener); } } launch.setDaemon(true); printMessage("launching mysqld (" + threadName + ")"); launch.start(); return launch; }
private Shell exec(String threadName, Map mysqldArgs, PrintStream outStream, PrintStream errStream, boolean withListeners) { deployFiles(); adjustParameterMap(mysqldArgs); String[] args = constructArgs(mysqldArgs); outStream.println(new ListToString().toString(args)); Shell launch = utils.shellFactory().newShell(args, threadName, outStream, errStream); if (withListeners) { for (int i = 0; i < completionListensers.size(); i++) { Runnable listener = (Runnable) completionListensers.get(i); launch.addCompletionListener(listener); } } launch.setDaemon(true); printMessage("launching mysqld (" + threadName + ")"); launch.start(); return launch; }
private Shell launchShell(String threadName, String[] args, int seconds) { Shell shell = utils.shellFactory().newShell(args, threadName, out, err); shell.start(); int fraction = 20; int loops = (fraction * seconds); do { utils.threads().pause((1000 / fraction)); } while (!shell.hasReturned() && loops-- > 0); if (!shell.hasReturned()) { err.println("Thread \"" + threadName + "\" may be hung"); err.println("(did not return after " + seconds + " seconds)"); err.println("command line used: "); err.println(new ListToString("", " ", "").toString(args)); } return shell; }
/** * 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 = { "/bin/chmod", "+x", executable.getPath() }; String tName = "make " + executable + " runable"; shellFactory.newShell(args, tName, out, err).run(); }
/** * 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(); }
/** * 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(); }