mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
CR-IC-2485 (deprecation policy specified; deprecated API usage upgraded)
This commit is contained in:
@@ -177,7 +177,8 @@ public class ExecUtil {
|
||||
* @return the results of running the process
|
||||
*/
|
||||
@NotNull
|
||||
public static ProcessOutput sudoAndGetOutput(@NotNull List<String> command, @NotNull String prompt,
|
||||
public static ProcessOutput sudoAndGetOutput(@NotNull List<String> command,
|
||||
@NotNull String prompt,
|
||||
@Nullable String workDir) throws IOException, ExecutionException {
|
||||
if (SystemInfo.isMac) {
|
||||
final String escapedCommandLine = StringUtil.join(command, new Function<String, String>() {
|
||||
@@ -242,22 +243,16 @@ public class ExecUtil {
|
||||
return "'" + arg.replace("'", "\\'") + "'";
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated It relies on platform-dependent escaping, use {@link #sudoAndGetOutput(java.util.List, String, String)} instead
|
||||
*/
|
||||
@NotNull
|
||||
public static ProcessOutput sudoAndGetOutput(@NotNull final String scriptPath,
|
||||
@NotNull final String prompt) throws IOException, ExecutionException {
|
||||
/** @deprecated relies on platform-dependent escaping, use {@link #sudoAndGetOutput(List, String, String)} instead (to remove in IDEA 14) */
|
||||
@SuppressWarnings({"UnusedDeclaration", "deprecation"})
|
||||
public static ProcessOutput sudoAndGetOutput(@NotNull String scriptPath, @NotNull String prompt) throws IOException, ExecutionException {
|
||||
return sudoAndGetOutput(scriptPath, prompt, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param scriptPath is already escaped file path
|
||||
* @deprecated It relies on platform-dependent escaping, use {@link #sudoAndGetOutput(java.util.List, String, String)} instead
|
||||
*/
|
||||
/** @deprecated relies on platform-dependent escaping, use {@link #sudoAndGetOutput(List, String, String)} instead (to remove in IDEA 14) */
|
||||
@NotNull
|
||||
public static ProcessOutput sudoAndGetOutput(@NotNull final String scriptPath,
|
||||
@NotNull final String prompt,
|
||||
public static ProcessOutput sudoAndGetOutput(@NotNull String scriptPath,
|
||||
@NotNull String prompt,
|
||||
@Nullable String workDir) throws IOException, ExecutionException {
|
||||
if (SystemInfo.isMac) {
|
||||
final String script = "do shell script \"" + scriptPath + "\" with administrator privileges";
|
||||
@@ -288,12 +283,10 @@ public class ExecUtil {
|
||||
throw new UnsupportedSystemException();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated It relies on platform-dependent escaping, use {@link #sudoAndGetOutput(java.util.List, String, String)} instead
|
||||
*/
|
||||
public static int sudoAndGetResult(@NotNull final String scriptPath,
|
||||
@NotNull final String prompt) throws IOException, ExecutionException {
|
||||
return sudoAndGetOutput(scriptPath, prompt).getExitCode();
|
||||
/** @deprecated relies on platform-dependent escaping, use {@link #sudoAndGetOutput(List, String, String)} instead (to remove in IDEA 14) */
|
||||
@SuppressWarnings({"UnusedDeclaration", "deprecation"})
|
||||
public static int sudoAndGetResult(@NotNull String scriptPath, @NotNull String prompt) throws IOException, ExecutionException {
|
||||
return sudoAndGetOutput(scriptPath, prompt, null).getExitCode();
|
||||
}
|
||||
|
||||
public static boolean hasTerminalApp() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -211,7 +211,8 @@ public class CreateDesktopEntryAction extends DumbAwareAction {
|
||||
"xdg-desktop-menu forceupdate --mode system\n" +
|
||||
"exit $RV\n");
|
||||
script.deleteOnExit();
|
||||
final int result = ExecUtil.sudoAndGetResult(script.getAbsolutePath(), ApplicationBundle.message("desktop.entry.sudo.prompt"));
|
||||
final String prompt = ApplicationBundle.message("desktop.entry.sudo.prompt");
|
||||
final int result = ExecUtil.sudoAndGetOutput(asList(script.getPath()), prompt, null).getExitCode();
|
||||
if (result != 0) throw new RuntimeException("'" + script.getAbsolutePath() + "' : " + result);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -112,8 +112,8 @@ public class CreateLauncherScriptAction extends DumbAwareAction {
|
||||
// copy file and change ownership to root (UID 0 = root, GID 0 = root (wheel on Macs))
|
||||
"install -g 0 -o 0 \"" + scriptFile.getCanonicalPath() + "\" \"" + pathName + "\"";
|
||||
final File installationScript = ExecUtil.createTempExecutableScript("launcher_installer", ".sh", installationScriptSrc);
|
||||
ExecUtil.sudoAndGetResult(installationScript.getAbsolutePath(),
|
||||
ApplicationBundle.message("launcher.script.sudo.prompt", launcherScriptContainingDirPath));
|
||||
final String prompt = ApplicationBundle.message("launcher.script.sudo.prompt", launcherScriptContainingDirPath);
|
||||
ExecUtil.sudoAndGetOutput(asList(installationScript.getPath()), prompt, null);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user