Search in sources :

Example 71 with GeneralCommandLine

use of com.intellij.execution.configurations.GeneralCommandLine in project android by JetBrains.

the class Haxm method getMacHaxmCommandLine.

private static GeneralCommandLine getMacHaxmCommandLine(File path) throws WizardException {
    // The new executable now requests admin access and executes the shell script. We need to make sure both exist and
    // are executable.
    ensureExistsAndIsExecutable(path, "silent_install.sh");
    File executable = ensureExistsAndIsExecutable(path, "HAXM installation");
    return new GeneralCommandLine(executable.getAbsolutePath()).withWorkDirectory(path);
}
Also used : GeneralCommandLine(com.intellij.execution.configurations.GeneralCommandLine) File(java.io.File)

Example 72 with GeneralCommandLine

use of com.intellij.execution.configurations.GeneralCommandLine in project android by JetBrains.

the class CheckSdkOperation method checkCanRunSdkTool.

private static boolean checkCanRunSdkTool(File executable) throws ExecutionException {
    GeneralCommandLine commandLine = new GeneralCommandLine(executable.getAbsolutePath());
    CapturingAnsiEscapesAwareProcessHandler handler = new CapturingAnsiEscapesAwareProcessHandler(commandLine);
    final int exitCode = handler.runProcess().getExitCode();
    // 1 means help was printed
    return exitCode == 1;
}
Also used : CapturingAnsiEscapesAwareProcessHandler(com.intellij.execution.process.CapturingAnsiEscapesAwareProcessHandler) GeneralCommandLine(com.intellij.execution.configurations.GeneralCommandLine)

Example 73 with GeneralCommandLine

use of com.intellij.execution.configurations.GeneralCommandLine in project android by JetBrains.

the class AccelerationErrorSolution method promptAndReboot.

/**
   * Prompts the user to reboot now, and performs the reboot if accepted.
   * HAXM Installer may need a reboot only on Windows, so this method is intended to work only on Windows
   * and only for HAXM installer use case
   *
   * @param prompt the message to display to the user
   * @exception ExecutionException if the shutdown command fails to execute
   * @return No return value
   */
public static void promptAndReboot(@NotNull String prompt) throws ExecutionException {
    int response = Messages.showOkCancelDialog((Project) null, prompt, "Reboot Now", Messages.getQuestionIcon());
    if (response == Messages.OK) {
        GeneralCommandLine reboot = new ElevatedCommandLine();
        reboot.setExePath("shutdown");
        // shutdown & restart after a 10 sec delay
        reboot.addParameters("/g", "/t", "10");
        reboot.setWorkDirectory(FileUtilRt.getTempDirectory());
        execute(reboot);
    }
}
Also used : GeneralCommandLine(com.intellij.execution.configurations.GeneralCommandLine)

Example 74 with GeneralCommandLine

use of com.intellij.execution.configurations.GeneralCommandLine in project android by JetBrains.

the class AccelerationErrorSolution method generateCommand.

private static GeneralCommandLine generateCommand(@NotNull String command, String... parameters) {
    GeneralCommandLine commandLine = new GeneralCommandLine();
    commandLine.setExePath(command);
    commandLine.addParameters(parameters);
    return commandLine;
}
Also used : GeneralCommandLine(com.intellij.execution.configurations.GeneralCommandLine)

Example 75 with GeneralCommandLine

use of com.intellij.execution.configurations.GeneralCommandLine in project android by JetBrains.

the class AndroidRunDdmsAction method doRunTool.

@Override
protected void doRunTool(@NotNull final Project project, @NotNull final String sdkPath) {
    if (getDdmsProcessHandler() != null) {
        Messages.showErrorDialog(project, AndroidBundle.message("android.launch.ddms.already.launched.error"), CommonBundle.getErrorTitle());
        return;
    }
    final boolean adbServiceEnabled = AndroidEnableAdbServiceAction.isAdbServiceEnabled();
    if (adbServiceEnabled && !AndroidEnableAdbServiceAction.disableAdbService(project)) {
        return;
    }
    final String toolPath = sdkPath + File.separator + AndroidCommonUtils.toolPath(getDdmsCmdName());
    final GeneralCommandLine commandLine = new GeneralCommandLine();
    commandLine.setExePath(toolPath);
    LOG.info(commandLine.getCommandLineString());
    ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {

        @Override
        public void run() {
            doLaunchDdms(commandLine, project, adbServiceEnabled);
        }
    });
}
Also used : GeneralCommandLine(com.intellij.execution.configurations.GeneralCommandLine)

Aggregations

GeneralCommandLine (com.intellij.execution.configurations.GeneralCommandLine)179 ExecutionException (com.intellij.execution.ExecutionException)70 NotNull (org.jetbrains.annotations.NotNull)47 File (java.io.File)41 VirtualFile (com.intellij.openapi.vfs.VirtualFile)31 OSProcessHandler (com.intellij.execution.process.OSProcessHandler)25 ProcessOutput (com.intellij.execution.process.ProcessOutput)25 Key (com.intellij.openapi.util.Key)18 ProcessEvent (com.intellij.execution.process.ProcessEvent)15 Project (com.intellij.openapi.project.Project)15 IOException (java.io.IOException)15 Nullable (org.jetbrains.annotations.Nullable)15 ProcessAdapter (com.intellij.execution.process.ProcessAdapter)14 CapturingProcessHandler (com.intellij.execution.process.CapturingProcessHandler)13 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)12 Sdk (com.intellij.openapi.projectRoots.Sdk)9 PsiFile (com.intellij.psi.PsiFile)9 ArrayList (java.util.ArrayList)9 Module (com.intellij.openapi.module.Module)8 ProcessHandler (com.intellij.execution.process.ProcessHandler)7