Search in sources :

Example 1 with GaugeExceptionHandler

use of com.thoughtworks.gauge.core.GaugeExceptionHandler in project Intellij-Plugin by getgauge.

the class GaugeModuleComponent method initializeGaugeProcess.

private static Process initializeGaugeProcess(int apiPort, Module module) {
    try {
        GaugeSettingsModel settings = getGaugeSettings();
        String port = String.valueOf(apiPort);
        ProcessBuilder gauge = new ProcessBuilder(settings.getGaugePath(), Constants.DAEMON, port);
        GaugeUtil.setGaugeEnvironmentsTo(gauge, settings);
        String cp = classpathForModule(module);
        LOG.info(String.format("Setting `%s` to `%s`", Constants.GAUGE_CUSTOM_CLASSPATH, cp));
        gauge.environment().put(Constants.GAUGE_CUSTOM_CLASSPATH, cp);
        File dir = moduleDir(module);
        LOG.info(String.format("Using `%s` as api port to connect to gauge API for project %s", port, dir));
        gauge.directory(dir);
        Process process = gauge.start();
        new GaugeExceptionHandler(process, module.getProject()).start();
        return process;
    } catch (IOException | GaugeNotFoundException e) {
        LOG.error("An error occurred while starting gauge api. \n" + e);
    }
    return null;
}
Also used : GaugeNotFoundException(com.thoughtworks.gauge.exception.GaugeNotFoundException) GaugeExceptionHandler(com.thoughtworks.gauge.core.GaugeExceptionHandler) IOException(java.io.IOException) File(java.io.File) GaugeSettingsModel(com.thoughtworks.gauge.settings.GaugeSettingsModel)

Aggregations

GaugeExceptionHandler (com.thoughtworks.gauge.core.GaugeExceptionHandler)1 GaugeNotFoundException (com.thoughtworks.gauge.exception.GaugeNotFoundException)1 GaugeSettingsModel (com.thoughtworks.gauge.settings.GaugeSettingsModel)1 File (java.io.File)1 IOException (java.io.IOException)1