• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java BaseOSProcessHandler类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.execution.process.BaseOSProcessHandler的典型用法代码示例。如果您正苦于以下问题:Java BaseOSProcessHandler类的具体用法?Java BaseOSProcessHandler怎么用?Java BaseOSProcessHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BaseOSProcessHandler类属于com.intellij.execution.process包,在下文中一共展示了BaseOSProcessHandler类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: attach

import com.intellij.execution.process.BaseOSProcessHandler; //导入依赖的package包/类
@Override
public void attach(@NotNull ProcessHandler processHandler)
{
	processHandler.putUserData(KEY, this);
	execute(() ->
	{
		int pid = -1;
		if(SystemInfo.isUnix && processHandler instanceof BaseOSProcessHandler)
		{
			pid = OSProcessUtil.getProcessID(((BaseOSProcessHandler) processHandler).getProcess());
		}
		synchronized(myLock)
		{
			myPid = pid;
		}
	});
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:18,代码来源:ProcessProxyImpl.java


示例2: executeOnPooledThread

import com.intellij.execution.process.BaseOSProcessHandler; //导入依赖的package包/类
protected static Future<?> executeOnPooledThread(Runnable task)
{
	final Application application = ApplicationManager.getApplication();

	if(application != null)
	{
		return application.executeOnPooledThread(task);
	}

	return BaseOSProcessHandler.ExecutorServiceHolder.submit(task);
}
 
开发者ID:consulo,项目名称:consulo-terminal,代码行数:12,代码来源:LocalTerminalDirectRunner.java


示例3: compileFile

import com.intellij.execution.process.BaseOSProcessHandler; //导入依赖的package包/类
private void compileFile(final CompileContext context, ModuleBuildTarget target, List<String> line, File source, File dir)
  throws StopBuildException {
  final JpsModule module = target.getModule();
  List<String> cmdLine = new ArrayList<String>(line);
  cmdLine.add(source.getAbsolutePath());

  StringBuilder cmdMessage = new StringBuilder();
  for (String cmdPart : cmdLine) {
    cmdMessage.append(cmdPart).append(' ');
  }

  context.processMessage(
    new CompilerMessage(getPresentableName(), BuildMessage.Kind.INFO, cmdMessage.toString())
  );

  try {
    Process process = new ProcessBuilder()
      .command(cmdLine)
      .start();


    BaseOSProcessHandler handler = new BaseOSProcessHandler(process, StringUtil.join(cmdLine, " "), CharsetToolkit.UTF8_CHARSET);

    final AtomicBoolean hasErrors = new AtomicBoolean();
    handler.addProcessListener(new ThriftOutputConsumer(source.getAbsolutePath(), context, hasErrors, module, dir));
    handler.startNotify();
    handler.waitFor();
    if (hasErrors.get()) {
      throw new StopBuildException();
    }
  }
  catch (IOException e) {
    context.processMessage(
      new CompilerMessage(getPresentableName(), BuildMessage.Kind.ERROR, "Failed to translate files . Error: " + e.getMessage())
    );
  }
}
 
开发者ID:fkorotkov,项目名称:intellij-thrift,代码行数:38,代码来源:ThriftBuilder.java


示例4: handleDexCompilationResult

import com.intellij.execution.process.BaseOSProcessHandler; //导入依赖的package包/类
public static void handleDexCompilationResult(@NotNull Process process,
                                              @NotNull String outputFilePath,
                                              @NotNull final Map<AndroidCompilerMessageKind, List<String>> messages, boolean multiDex) {
  final BaseOSProcessHandler handler = new BaseOSProcessHandler(process, null, null);
  handler.addProcessListener(new ProcessAdapter() {
    private AndroidCompilerMessageKind myCategory = null;

    @Override
    public void onTextAvailable(ProcessEvent event, Key outputType) {
      String[] msgs = event.getText().split("\\n");
      for (String msg : msgs) {
        msg = msg.trim();
        String msglc = msg.toLowerCase();
        if (outputType == ProcessOutputTypes.STDERR) {
          if (WARNING_PATTERN.matcher(msglc).matches()) {
            myCategory = AndroidCompilerMessageKind.WARNING;
          }
          if (ERROR_PATTERN.matcher(msglc).matches() || EXCEPTION_PATTERN.matcher(msglc).matches() || myCategory == null) {
            myCategory = AndroidCompilerMessageKind.ERROR;
          }
          messages.get(myCategory).add(msg);
        }
        else if (outputType == ProcessOutputTypes.STDOUT) {
          if (!msglc.startsWith("processing")) {
            messages.get(AndroidCompilerMessageKind.INFORMATION).add(msg);
          }
        }

        LOG.debug(msg);
      }
    }
  });

  handler.startNotify();
  handler.waitFor();

  final List<String> errors = messages.get(AndroidCompilerMessageKind.ERROR);

  if (new File(outputFilePath).isFile()) {
    // if compilation finished correctly, show all errors as warnings
    messages.get(AndroidCompilerMessageKind.WARNING).addAll(errors);
    errors.clear();
  }
  else if (errors.size() == 0 && !multiDex) {
    errors.add("Cannot create classes.dex file");
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:48,代码来源:AndroidCommonUtils.java


示例5: runGroovyc

import com.intellij.execution.process.BaseOSProcessHandler; //导入依赖的package包/类
@Override
public GroovycContinuation runGroovyc(Collection<String> compilationClassPath,
                                      boolean forStubs,
                                      JpsGroovySettings settings,
                                      File tempFile,
                                      final GroovycOutputParser parser)
  throws Exception {
  List<String> classpath = new ArrayList<String>();
  if (myOptimizeClassLoading) {
    classpath.addAll(GroovyBuilder.getGroovyRtRoots());
    classpath.add(ClasspathBootstrap.getResourcePath(Function.class));
    classpath.add(ClasspathBootstrap.getResourcePath(UrlClassLoader.class));
    classpath.add(ClasspathBootstrap.getResourceFile(THashMap.class).getPath());
  } else {
    classpath.addAll(compilationClassPath);
  }

  List<String> vmParams = ContainerUtilRt.newArrayList();
  vmParams.add("-Xmx" + System.getProperty("groovyc.heap.size", settings.heapSize) + "m");
  vmParams.add("-Dfile.encoding=" + System.getProperty("file.encoding"));
  //vmParams.add("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5239");
  
  if ("false".equals(System.getProperty(GroovyRtConstants.GROOVYC_ASM_RESOLVING_ONLY))) {
    vmParams.add("-D" + GroovyRtConstants.GROOVYC_ASM_RESOLVING_ONLY + "=false");
  }
  String configScript = settings.configScript;
  if (StringUtil.isNotEmpty(configScript)) {
    vmParams.add("-D" + GroovyRtConstants.GROOVYC_CONFIG_SCRIPT + "=" + configScript);
  }

  String grapeRoot = System.getProperty(GroovycOutputParser.GRAPE_ROOT);
  if (grapeRoot != null) {
    vmParams.add("-D" + GroovycOutputParser.GRAPE_ROOT + "=" + grapeRoot);
  }

  final List<String> cmd = ExternalProcessUtil.buildJavaCommandLine(
    getJavaExecutable(myChunk),
    "org.jetbrains.groovy.compiler.rt.GroovycRunner",
    Collections.<String>emptyList(), classpath,
    vmParams,
    getProgramParams(tempFile, settings, forStubs)
  );
  final Process process = Runtime.getRuntime().exec(ArrayUtil.toStringArray(cmd));
  ProcessHandler handler = new BaseOSProcessHandler(process, null, null) {
    @Override
    protected Future<?> executeOnPooledThread(Runnable task) {
      return SharedThreadPool.getInstance().executeOnPooledThread(task);
    }

    @Override
    public void notifyTextAvailable(String text, Key outputType) {
      parser.notifyTextAvailable(text, outputType);
    }
  };

  handler.startNotify();
  handler.waitFor();
  parser.notifyFinished(process.exitValue());
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:61,代码来源:ForkedGroovyc.java


示例6: ExternalJavacDescriptor

import com.intellij.execution.process.BaseOSProcessHandler; //导入依赖的package包/类
public ExternalJavacDescriptor(BaseOSProcessHandler process, JavacServerClient client) {
  this.process = process;
  this.client = client;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:5,代码来源:ExternalJavacDescriptor.java


示例7: run

import com.intellij.execution.process.BaseOSProcessHandler; //导入依赖的package包/类
/**
 * Runs {@link IgnoreLanguage} executable with the given command and current working directory.
 *
 * @param language  current language
 * @param command   to call
 * @param directory current working directory
 * @param parser    {@link ExecutionOutputParser} implementation
 * @param <T>       return type
 * @return result of the call
 */
@Nullable
private static <T> ArrayList<T> run(@NotNull IgnoreLanguage language,
                                    @NotNull String command,
                                    @Nullable VirtualFile directory,
                                    @Nullable final ExecutionOutputParser<T> parser) {
    final String bin = bin(language);
    if (bin == null) {
        return null;
    }

    try {
        final String cmd = bin + " " + command;
        final File workingDirectory = directory != null ? new File(directory.getPath()) : null;
        final Process process = Runtime.getRuntime().exec(cmd, null, workingDirectory);

        ProcessHandler handler = new BaseOSProcessHandler(process, StringUtil.join(cmd, " "), null) {
            @NotNull
            @Override
            protected Future<?> executeOnPooledThread(@NotNull Runnable task) {
                return SharedThreadPool.getInstance().executeOnPooledThread(task);
            }

            @Override
            public void notifyTextAvailable(String text, Key outputType) {
                if (parser != null) {
                    parser.onTextAvailable(text, outputType);
                }
            }
        };

        handler.startNotify();
        if (!handler.waitFor(DEFAULT_TIMEOUT)) {
            return null;
        }
        if (parser != null) {
            parser.notifyFinished(process.exitValue());
            if (parser.isErrorsReported()) {
                return null;
            }
            return parser.getOutput();
        }
    } catch (IOException ignored) {
    }

    return null;
}
 
开发者ID:hsz,项目名称:idea-gitignore,代码行数:57,代码来源:ExternalExec.java



注:本文中的com.intellij.execution.process.BaseOSProcessHandler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SnmpParams类代码示例发布时间:2022-05-22
下一篇:
Java DataResource类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap