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

Java ExecUtil类代码示例

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

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



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

示例1: listDevices

import com.intellij.execution.util.ExecUtil; //导入依赖的package包/类
@Test
    public void listDevices() {
        System.out.println(
                System.getProperty("user.home"));
//        System.getProperties().list(System.out);

        GeneralCommandLine commandLine = RNPathUtil.cmdToGeneralCommandLine(IOSDevicesParser.LIST_Simulator_JSON);

        try {
            String json = ExecUtil.execAndGetOutput(commandLine).getStdout();
            System.out.println("json=" + json);
            Simulators result = new Gson().fromJson(json, Simulators.class);
            System.out.println(result.devices.keySet());
            System.out.println(result.devices.get("iOS 10.3")[0]);
        } catch (ExecutionException e) {
            e.printStackTrace();
            NotificationUtils.errorNotification( "xcrun invocation failed. Please check that Xcode is installed." );
        }

    }
 
开发者ID:beansoftapp,项目名称:react-native-console,代码行数:21,代码来源:TestParseIOSDevices.java


示例2: parseCurrentPathFromRNConsoleJsonFile

import com.intellij.execution.util.ExecUtil; //导入依赖的package包/类
@Test
    public void parseCurrentPathFromRNConsoleJsonFile() {
        //        System.out.println(
//                System.getProperty("user.home"));
//        System.getProperties().list(System.out);

        GeneralCommandLine commandLine = RNPathUtil.cmdToGeneralCommandLine(IOSDevicesParser.LIST_DEVICES);
        try {
            String json = ExecUtil.execAndGetOutput(commandLine).getStdout();
            System.out.println(json);
            Arrays.asList(json.split("\n")).forEach(line -> {
                System.out.println(line);
//                Pattern pattern = Pattern
//                        .compile("^([hH][tT]{2}[pP]://|[hH][tT]{2}[pP][sS]://)(([A-Za-z0-9-~]+).)+([A-Za-z0-9-~\\/])+$");
                boolean device = line.matches("^(.*?) \\((.*?)\\)\\ \\[(.*?)\\]");
                System.out.println("device=" + device);
//                String noSimulator = line.match(/(.*?) \((.*?)\) \[(.*?)\] \((.*?)\)/);
            });

        } catch (ExecutionException e) {
            e.printStackTrace();
            NotificationUtils.errorNotification( "xcrun invocation failed. Please check that Xcode is installed." );
            return;
        }
    }
 
开发者ID:beansoftapp,项目名称:react-native-console,代码行数:26,代码来源:TestParseIOSDevices.java


示例3: getOpenBrowserCommand

import com.intellij.execution.util.ExecUtil; //导入依赖的package包/类
@NotNull
public static List<String> getOpenBrowserCommand(@NonNls @NotNull String browserPathOrName, boolean newWindowIfPossible) {
  if (new File(browserPathOrName).isFile()) {
    return Collections.singletonList(browserPathOrName);
  }
  else if (SystemInfo.isMac) {
    List<String> command = newArrayList(ExecUtil.getOpenCommandPath(), "-a", browserPathOrName);
    if (newWindowIfPossible) {
      command.add("-n");
    }
    return command;
  }
  else if (SystemInfo.isWindows) {
    return Arrays.asList(ExecUtil.getWindowsShellName(), "/c", "start", GeneralCommandLine.inescapableQuote(""), browserPathOrName);
  }
  else {
    return Collections.singletonList(browserPathOrName);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:BrowserUtil.java


示例4: getAwesomeWMVersion

import com.intellij.execution.util.ExecUtil; //导入依赖的package包/类
@Nullable
private static String getAwesomeWMVersion() {
  try {
    String version = ExecUtil.execAndReadLine(new GeneralCommandLine("awesome", "--version"));
    if (version != null) {
      Matcher m = Pattern.compile("awesome v([0-9.]+)").matcher(version);
      if (m.find()) {
        return m.group(1);
      }
    }
  }
  catch (Throwable t) {
    LOG.warn(t);
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:X11UiUtil.java


示例5: checkIBus

import com.intellij.execution.util.ExecUtil; //导入依赖的package包/类
private void checkIBus() {
  if (SystemInfo.isXWindow) {
    String xim = System.getenv("XMODIFIERS");
    if (xim != null && xim.contains("im=ibus")) {
      String version = ExecUtil.execAndReadLine(new GeneralCommandLine("ibus-daemon", "--version"));
      if (version != null) {
        Matcher m = Pattern.compile("ibus-daemon - Version ([0-9.]+)").matcher(version);
        if (m.find() && StringUtil.compareVersionNumbers(m.group(1), "1.5.11") < 0) {
          String fix = System.getenv("IBUS_ENABLE_SYNC_MODE");
          if (fix == null || fix.isEmpty() || fix.equals("0") || fix.equalsIgnoreCase("false")) {
            showNotification("ibus.blocking.warn.message");
          }
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:SystemHealthMonitor.java


示例6: compute

import com.intellij.execution.util.ExecUtil; //导入依赖的package包/类
@NotNull
@Override
protected Boolean compute() {
  if (!SystemInfo.isUnix || !SystemInfo.hasXdgMime() || !new File("/usr/bin/nautilus").canExecute()) {
    return false;
  }

  String appName = ExecUtil.execAndReadLine(new GeneralCommandLine("xdg-mime", "query", "default", "inode/directory"));
  if (appName == null || !appName.matches("nautilus.*\\.desktop")) return false;

  String version = ExecUtil.execAndReadLine(new GeneralCommandLine("nautilus", "--version"));
  if (version == null) return false;

  Matcher m = Pattern.compile("GNOME nautilus ([0-9.]+)").matcher(version);
  return m.find() && StringUtil.compareVersionNumbers(m.group(1), "3") >= 0;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ShowFilePathAction.java


示例7: unicodePath

import com.intellij.execution.util.ExecUtil; //导入依赖的package包/类
@Test
public void unicodePath() throws Exception {
  String mark = String.valueOf(new Random().nextInt());
  String prefix = "spaces 'and quotes' and " + UNICODE_RU + "_" + UNICODE_EU + " ";

  File script;
  if (SystemInfo.isWindows) {
    script = ExecUtil.createTempExecutableScript(prefix, ".cmd", "@echo " + mark + "\n");
  }
  else {
    script = ExecUtil.createTempExecutableScript(prefix, ".sh", "#!/bin/sh\n" + "echo " + mark + "\n");
  }

  try {
    String output = execAndGetOutput(new GeneralCommandLine(script.getPath()));
    assertEquals(mark + "\n", StringUtil.convertLineSeparators(output));
  }
  finally {
    FileUtil.delete(script);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:GeneralCommandLineTest.java


示例8: passingArgumentsToJavaAppThroughCmdScriptAndWinShell

import com.intellij.execution.util.ExecUtil; //导入依赖的package包/类
@Test
public void passingArgumentsToJavaAppThroughCmdScriptAndWinShell() throws Exception {
  assumeTrue(SystemInfo.isWindows);

  Pair<GeneralCommandLine, File> command = makeHelperCommand(null, CommandTestHelper.ARG);
  File script = ExecUtil.createTempExecutableScript("my script ", ".cmd", "@" + command.first.getCommandLineString() + " %*");
  try {
    GeneralCommandLine commandLine = new GeneralCommandLine(ExecUtil.getWindowsShellName(), "/D", "/C", "call", script.getAbsolutePath());
    commandLine.addParameters(ARGUMENTS);
    String output = execHelper(pair(commandLine, command.second));
    checkParamPassing(output, ARGUMENTS);
  }
  finally {
    FileUtil.delete(script);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:GeneralCommandLineTest.java


示例9: winShellScriptQuoting

import com.intellij.execution.util.ExecUtil; //导入依赖的package包/类
@Test
public void winShellScriptQuoting() throws Exception {
  assumeTrue(SystemInfo.isWindows);

  String scriptPrefix = "my_script";
  for (String scriptExt : new String[]{".cmd", ".bat"}) {
    File script = ExecUtil.createTempExecutableScript(scriptPrefix, scriptExt, "@echo %1\n");
    String param = "a&b";
    GeneralCommandLine commandLine = new GeneralCommandLine(script.getAbsolutePath(), param);
    String text = commandLine.getPreparedCommandLine(Platform.WINDOWS);
    assertEquals(commandLine.getExePath() + "\n" + StringUtil.wrapWithDoubleQuote(param), text);
    try {
      String output = execAndGetOutput(commandLine);
      assertEquals(StringUtil.wrapWithDoubleQuote(param), output.trim());
    }
    finally {
      FileUtil.delete(script);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:GeneralCommandLineTest.java


示例10: createProcess

import com.intellij.execution.util.ExecUtil; //导入依赖的package包/类
@NotNull
@Override
protected Process createProcess() throws ExecutionException {
  checkRedirectFile();

  List<String> parameters = escapeArguments(buildParameters());
  parameters.add(0, ExecUtil.getWindowsShellName());
  parameters.add(1, "/c");
  parameters.add(">>");
  //noinspection ConstantConditions
  parameters.add(quote(myRedirectFile.getAbsolutePath()));

  Process process = createProcess(parameters);

  return new ProcessWrapper(process) {
    @Override
    public InputStream getInputStream() {
      return myRedirectStream;
    }

    @Override
    public InputStream getErrorStream() {
      return getOriginalProcess().getInputStream();
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:WinTerminalExecutor.java


示例11: getVersionString

import com.intellij.execution.util.ExecUtil; //导入依赖的package包/类
@Nullable
@Override
public String getVersionString(String s)
{
	try
	{
		GeneralCommandLine commandLine = new GeneralCommandLine();
		commandLine.setExePath(getExePath(s).getPath());
		commandLine.withWorkDirectory(s);
		commandLine.addParameter("-v");

		ProcessOutput processOutput = ExecUtil.execAndGetOutput(commandLine);
		String stdout = processOutput.getStdout();
		if(StringUtil.startsWith(stdout, "v"))
		{
			stdout = stdout.substring(1, stdout.length());
		}
		return stdout.trim();
	}
	catch(ExecutionException e)
	{
		return null;
	}
}
 
开发者ID:consulo,项目名称:consulo-nodejs,代码行数:25,代码来源:NodeJSBundleType.java


示例12: getOpenBrowserCommand

import com.intellij.execution.util.ExecUtil; //导入依赖的package包/类
@NotNull
public static List<String> getOpenBrowserCommand(@NonNls @NotNull String browserPathOrName, boolean newWindowIfPossible) {
  if (new File(browserPathOrName).isFile()) {
    return newSmartList(browserPathOrName);
  }
  else if (SystemInfo.isMac) {
    List<String> command = newArrayList(ExecUtil.getOpenCommandPath(), "-a", browserPathOrName);
    if (newWindowIfPossible) {
      command.add("-n");
    }
    return command;
  }
  else if (SystemInfo.isWindows) {
    return newArrayList(ExecUtil.getWindowsShellName(), "/c", "start", GeneralCommandLine.inescapableQuote(""), browserPathOrName);
  }
  else {
    return newSmartList(browserPathOrName);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:BrowserUtil.java


示例13: compute

import com.intellij.execution.util.ExecUtil; //导入依赖的package包/类
@NotNull
@Override
protected Boolean compute() {
  if (!SystemInfo.isUnix || !SystemInfo.hasXdgMime() || !new File("/usr/bin/nautilus").canExecute()) {
    return false;
  }

  String appName = ExecUtil.execAndReadLine("xdg-mime", "query", "default", "inode/directory");
  if (appName == null || !appName.matches("nautilus.*\\.desktop")) return false;

  String version = ExecUtil.execAndReadLine("nautilus", "--version");
  if (version == null) return false;

  Matcher m = Pattern.compile("GNOME nautilus ([0-9.]+)").matcher(version);
  return m.find() && StringUtil.compareVersionNumbers(m.group(1), "3") >= 0;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:ShowFilePathAction.java


示例14: unicodePath

import com.intellij.execution.util.ExecUtil; //导入依赖的package包/类
@Test
public void unicodePath() throws Exception {
  String mark = String.valueOf(new Random().nextInt());
  File script;
  if (SystemInfo.isWindows) {
    script = ExecUtil.createTempExecutableScript(
      "path with spaces 'and quotes' и юникодом ", ".cmd",
      "@echo " + mark + "\n"
    );
  }
  else {
    script = ExecUtil.createTempExecutableScript(
      "path with spaces 'and quotes' и юникодом ", ".sh",
      "#!/bin/sh\n" + "echo " + mark + "\n"
    );
  }

  try {
    GeneralCommandLine commandLine = new GeneralCommandLine(script.getPath());
    String output = execAndGetOutput(commandLine, null);
    assertEquals(mark + "\n", StringUtil.convertLineSeparators(output));
  }
  finally {
    FileUtil.delete(script);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:GeneralCommandLineTest.java


示例15: addArgs

import com.intellij.execution.util.ExecUtil; //导入依赖的package包/类
private static void addArgs(List<String> command, @Nullable BrowserSpecificSettings settings, String[] additional) {
  String[] specific = settings != null ? settings.getAdditionalParameters() : ArrayUtil.EMPTY_STRING_ARRAY;

  if (specific.length + additional.length > 0) {
    if (SystemInfo.isMac && ExecUtil.getOpenCommandPath().equals(command.get(0))) {
      if (!BrowserUtil.isOpenCommandSupportArgs()) {
        LOG.warn("'open' command doesn't allow to pass command line arguments so they will be ignored: " +
                 Arrays.toString(specific) + " " + Arrays.toString(additional));
      }
      else {
        command.add("--args");
      }
    }

    Collections.addAll(command, specific);
    Collections.addAll(command, additional);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:DefaultUrlOpener.java


示例16: getVersionString

import com.intellij.execution.util.ExecUtil; //导入依赖的package包/类
@Nullable
@Override
public String getVersionString(String sdkHome)
{
	List<String> args = new ArrayList<String>(2);
	args.add(getExecutable(sdkHome));
	args.add("-version");
	try
	{
		ProcessOutput processOutput = ExecUtil.execAndGetOutput(args, sdkHome);
		for(String s : processOutput.getStdoutLines())
		{
			if(s.startsWith("ikvm"))
			{
				return s.substring(5, s.length()).trim();
			}
		}
	}
	catch(ExecutionException e)
	{
		return null;
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-ikvm,代码行数:25,代码来源:IkvmBundleType.java


示例17: getOpenBrowserCommand

import com.intellij.execution.util.ExecUtil; //导入依赖的package包/类
@Nonnull
public static List<String> getOpenBrowserCommand(@NonNls @Nonnull String browserPathOrName, boolean newWindowIfPossible) {
  if (new File(browserPathOrName).isFile()) {
    return Collections.singletonList(browserPathOrName);
  }
  else if (SystemInfo.isMac) {
    List<String> command = newArrayList(ExecUtil.getOpenCommandPath(), "-a", browserPathOrName);
    if (newWindowIfPossible) {
      command.add("-n");
    }
    return command;
  }
  else if (SystemInfo.isWindows) {
    return Arrays.asList(ExecUtil.getWindowsShellName(), "/c", "start", GeneralCommandLine.inescapableQuote(""), browserPathOrName);
  }
  else {
    return Collections.singletonList(browserPathOrName);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:BrowserUtil.java


示例18: checkIBus

import com.intellij.execution.util.ExecUtil; //导入依赖的package包/类
private void checkIBus() {
  if (SystemInfo.isXWindow) {
    String xim = System.getenv("XMODIFIERS");
    if (xim != null && xim.contains("im=ibus")) {
      String version = ExecUtil.execAndReadLine(new GeneralCommandLine("ibus-daemon", "--version"));
      if (version != null) {
        Matcher m = Pattern.compile("ibus-daemon - Version ([0-9.]+)").matcher(version);
        if (m.find() && StringUtil.compareVersionNumbers(m.group(1), "1.5.11") < 0) {
          String fix = System.getenv("IBUS_ENABLE_SYNC_MODE");
          if (fix == null || fix.isEmpty() || fix.equals("0") || fix.equalsIgnoreCase("false")) {
            showNotification(new KeyHyperlinkAdapter("ibus.blocking.warn.message"));
          }
        }
      }
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:SystemHealthMonitor.java


示例19: compute

import com.intellij.execution.util.ExecUtil; //导入依赖的package包/类
@Nonnull
@Override
protected Boolean compute() {
  if (!SystemInfo.isUnix || !SystemInfo.hasXdgMime() || !new File("/usr/bin/nautilus").canExecute()) {
    return false;
  }

  String appName = ExecUtil.execAndReadLine("xdg-mime", "query", "default", "inode/directory");
  if (appName == null || !appName.matches("nautilus.*\\.desktop")) return false;

  String version = ExecUtil.execAndReadLine("nautilus", "--version");
  if (version == null) return false;

  Matcher m = Pattern.compile("GNOME nautilus ([0-9.]+)").matcher(version);
  return m.find() && StringUtil.compareVersionNumbers(m.group(1), "3") >= 0;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:ShowFilePathAction.java


示例20: prepare

import com.intellij.execution.util.ExecUtil; //导入依赖的package包/类
private static File prepare() throws IOException {
  File distributionDirectory = PathManager.getAppHomeDirectory();
  String name = ApplicationNamesInfo.getInstance().getFullProductName();

  final String iconPath = AppUIUtil.findIcon(distributionDirectory.getPath());
  if (iconPath == null) {
    throw new RuntimeException(ApplicationBundle.message("desktop.entry.icon.missing", distributionDirectory.getPath()));
  }

  final File execPath = new File(distributionDirectory, "consulo.sh");
  if (!execPath.exists()) {
    throw new RuntimeException(ApplicationBundle.message("desktop.entry.script.missing", distributionDirectory.getPath()));
  }

  final String wmClass = AppUIUtil.getFrameClass();

  final String content = ExecUtil.loadTemplate(CreateDesktopEntryAction.class.getClassLoader(), "entry.desktop", ContainerUtil
          .newHashMap(Arrays.asList("$NAME$", "$SCRIPT$", "$ICON$", "$WM_CLASS$"), Arrays.asList(name, execPath.getPath(), iconPath, wmClass)));

  final String entryName = wmClass + ".desktop";
  final File entryFile = new File(FileUtil.getTempDirectory(), entryName);
  FileUtil.writeToFile(entryFile, content);
  entryFile.deleteOnExit();
  return entryFile;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:26,代码来源:CreateDesktopEntryAction.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java EntityCapsManager类代码示例发布时间:2022-05-22
下一篇:
Java CreateSnapshotResponse类代码示例发布时间: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