本文整理匯總了Java中com.intellij.execution.configurations.GeneralCommandLine類的典型用法代碼示例。如果您正苦於以下問題:Java GeneralCommandLine類的具體用法?Java GeneralCommandLine怎麽用?Java GeneralCommandLine使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
GeneralCommandLine類屬於com.intellij.execution.configurations包,在下文中一共展示了GeneralCommandLine類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: listDevices
import com.intellij.execution.configurations.GeneralCommandLine; //導入依賴的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." );
}
}
示例2: parseCurrentPathFromRNConsoleJsonFile
import com.intellij.execution.configurations.GeneralCommandLine; //導入依賴的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;
}
}
示例3: buildCommandLineParameters
import com.intellij.execution.configurations.GeneralCommandLine; //導入依賴的package包/類
@Override
protected void buildCommandLineParameters(GeneralCommandLine commandLine) {
commandLine.setWorkDirectory(myTaskDir.getPath());
ParamsGroup group = commandLine.getParametersList().getParamsGroup(GROUP_SCRIPT);
assert group != null;
Project project = myRunConfiguration.getProject();
Course course = StudyTaskManager.getInstance(project).getCourse();
assert course != null;
group.addParameter(myRunConfiguration.getPathToTest());
String path = getCurrentTaskFilePath();
if (path != null) {
group.addParameter(path);
}
}
示例4: run
import com.intellij.execution.configurations.GeneralCommandLine; //導入依賴的package包/類
public void run() throws Exception
{
// Prepare and run node-command which will fetch settings.
GeneralCommandLine commandLine = createCommandLine();
Process process = commandLine.createProcess();
String input = readInputStream(process.getInputStream());
Gson gson = new GsonBuilder()
.registerTypeAdapter(DefaultValue.class, new DefaultValueDeserializer())
.create();
Type targetType = new TypeToken<List<SettingTreeNode>>() {}.getType();
List<SettingTreeNode> settings = gson.fromJson(input, targetType);
if (settings == null)
{
String error = readInputStream(process.getErrorStream());
String message = error.length() > 0 ? error : input;
throw new Exception("Error occured while fetching completions: " + message);
}
SettingContainer completions = new SettingContainer(settings);
CompletionPreloader.setCompletions(completions);
}
示例5: createCommandLine
import com.intellij.execution.configurations.GeneralCommandLine; //導入依賴的package包/類
private GeneralCommandLine createCommandLine() throws Exception
{
GeneralCommandLine commandLine = new GeneralCommandLine();
commandLine
.withParentEnvironmentType(GeneralCommandLine.ParentEnvironmentType.CONSOLE)
.withCharset(StandardCharsets.UTF_8)
.withWorkDirectory(project.getBasePath());
NodeJsLocalInterpreter interpreter = NodeJsLocalInterpreterManager
.getInstance()
.detectMostRelevant();
if (interpreter == null)
{
throw new Exception("Unable to create node-interpreter.");
}
// Move getSettings.js resource to .idea-folder within current project.
ensureJsFile();
commandLine.setExePath(interpreter.getInterpreterSystemDependentPath());
commandLine.addParameter(getJsFilePath());
commandLine.addParameter("roc-config");
return commandLine;
}
示例6: setCommandLineParameters
import com.intellij.execution.configurations.GeneralCommandLine; //導入依賴的package包/類
@Override
public void setCommandLineParameters(@NotNull final GeneralCommandLine cmd,
@NotNull final Project project,
@NotNull final String filePath,
@NotNull final String sdkPath,
@NotNull final Task currentTask) {
final List<UserTest> userTests = StudyTaskManager.getInstance(project).getUserTests(currentTask);
if (!userTests.isEmpty()) {
StudyLanguageManager manager = StudyUtils.getLanguageManager(currentTask.getLesson().getCourse());
if (manager != null) {
cmd.addParameter(new File(project.getBaseDir().getPath(), manager.getUserTester()).getPath());
cmd.addParameter(sdkPath);
cmd.addParameter(filePath);
}
}
else {
cmd.addParameter(filePath);
}
}
示例7: generateCommandLine
import com.intellij.execution.configurations.GeneralCommandLine; //導入依賴的package包/類
protected GeneralCommandLine generateCommandLine() {
GeneralCommandLine commandLine = new GeneralCommandLine();
final LuaRunConfiguration cfg = (LuaRunConfiguration) runConfiguration;
if (cfg.isOverrideSDKInterpreter()) {
if (!StringUtil.isEmptyOrSpaces(cfg.getInterpreterPath()))
commandLine.setExePath(cfg.getInterpreterPath());
} else {
final Sdk sdk = cfg.getSdk();
if (sdk == null) {
fillInterpreterCommandLine(commandLine);
} else if (sdk.getSdkType() instanceof LuaSdkType) {
String sdkHomePath = StringUtil.notNullize(sdk.getHomePath());
String sdkInterpreter = getTopLevelExecutable(sdkHomePath).getAbsolutePath();
commandLine.setExePath(sdkInterpreter);
}
}
commandLine.getEnvironment().putAll(cfg.getEnvs());
commandLine.setPassParentEnvironment(cfg.isPassParentEnvs());
return configureCommandLine(commandLine);
}
示例8: removeRepository
import com.intellij.execution.configurations.GeneralCommandLine; //導入依賴的package包/類
@Override
public void removeRepository(String repositoryUrl) {
final String conda = PyCondaPackageService.getCondaExecutable();
final ArrayList<String> parameters = Lists.newArrayList(conda, "config", "--remove", "channels", repositoryUrl, "--force");
final GeneralCommandLine commandLine = new GeneralCommandLine(parameters);
try {
final Process process = commandLine.createProcess();
final CapturingProcessHandler handler = new CapturingProcessHandler(process);
final ProcessOutput result = handler.runProcess();
final int exitCode = result.getExitCode();
if (exitCode != 0) {
final String message = StringUtil.isEmptyOrSpaces(result.getStdout()) && StringUtil.isEmptyOrSpaces(result.getStderr()) ?
"Permission denied" : "Non-zero exit code";
LOG.warn("Failed to remove repository " + message);
}
PyCondaPackageService.getInstance().removeChannel(repositoryUrl);
}
catch (ExecutionException e) {
LOG.warn("Failed to remove repository");
}
}
示例9: dumpPdbGuidsToFile
import com.intellij.execution.configurations.GeneralCommandLine; //導入依賴的package包/類
public int dumpPdbGuidsToFile(Collection<File> files, File output, BuildProgressLogger buildLogger) throws IOException {
final GeneralCommandLine commandLine = new GeneralCommandLine();
commandLine.setExePath(myExePath.getPath());
commandLine.addParameter(DUMP_SYMBOL_SIGN_CMD);
commandLine.addParameter(String.format("/o=%s", output.getPath()));
commandLine.addParameter(String.format("/i=%s", dumpPathsToFile(files).getPath()));
buildLogger.message(String.format("Running command %s", commandLine.getCommandLineString()));
final ExecResult execResult = SimpleCommandLineProcessRunner.runCommand(commandLine, null);
final String stdout = execResult.getStdout();
if(!stdout.isEmpty()){
buildLogger.message("Stdout: " + stdout);
}
final int exitCode = execResult.getExitCode();
if (exitCode != 0) {
buildLogger.warning(String.format("%s ends with non-zero exit code %s.", SYMBOLS_EXE, execResult));
buildLogger.warning("Stdout: " + stdout);
buildLogger.warning("Stderr: " + execResult.getStderr());
final Throwable exception = execResult.getException();
if(exception != null){
buildLogger.exception(exception);
}
}
return exitCode;
}
示例10: ShellCommand
import com.intellij.execution.configurations.GeneralCommandLine; //導入依賴的package包/類
public ShellCommand(@Nullable List<String> commandLine, @Nullable String dir, @Nullable Charset charset) {
if (commandLine == null || commandLine.isEmpty()) {
throw new IllegalArgumentException("commandLine is empty");
}
myCommandLine = new GeneralCommandLine(commandLine);
if (dir != null) {
myCommandLine.setWorkDirectory(new File(dir));
}
if (charset != null) {
myCommandLine.setCharset(charset);
}
if (ApplicationManager.getApplication().isUnitTestMode()) {
//ignore all hg config files except current repository config
myCommandLine.getEnvironment().put("HGRCPATH", "");
}
}
示例11: executeProcess
import com.intellij.execution.configurations.GeneralCommandLine; //導入依賴的package包/類
public ConsoleProcessDescriptor executeProcess(final Module module,
final GeneralCommandLine commandLine,
@Nullable final Runnable onDone,
boolean showConsole,
final boolean closeOnDone,
final String... input) {
ApplicationManager.getApplication().assertIsDispatchThread();
assert module.getProject() == myProject;
final MyProcessInConsole process = new MyProcessInConsole(module, commandLine, onDone, showConsole, closeOnDone, input);
if (isExecuting()) {
myProcessQueue.add(process);
}
else {
executeProcessImpl(process, true);
}
return process;
}
示例12: doStartRemoteProcess
import com.intellij.execution.configurations.GeneralCommandLine; //導入依賴的package包/類
protected PyRemoteProcessHandlerBase doStartRemoteProcess(@NotNull Sdk sdk,
@NotNull final GeneralCommandLine commandLine,
@NotNull final PythonRemoteInterpreterManager manager,
@Nullable final Project project,
@Nullable PyRemotePathMapper pathMapper)
throws ExecutionException {
SdkAdditionalData data = sdk.getSdkAdditionalData();
assert data instanceof PyRemoteSdkAdditionalDataBase;
final PyRemoteSdkAdditionalDataBase pyRemoteSdkAdditionalDataBase = (PyRemoteSdkAdditionalDataBase)data;
final PyRemotePathMapper extendedPathMapper = manager.setupMappings(project, pyRemoteSdkAdditionalDataBase, pathMapper);
try {
return PyRemoteProcessStarterManagerUtil
.getManager(pyRemoteSdkAdditionalDataBase).startRemoteProcess(project, commandLine, manager, pyRemoteSdkAdditionalDataBase,
extendedPathMapper);
}
catch (InterruptedException e) {
throw new ExecutionException(e);
}
}
示例13: addArgs
import com.intellij.execution.configurations.GeneralCommandLine; //導入依賴的package包/類
private static void addArgs(@NotNull GeneralCommandLine command, @Nullable BrowserSpecificSettings settings, @NotNull String[] additional) {
List<String> specific = settings == null ? Collections.<String>emptyList() : settings.getAdditionalParameters();
if (specific.size() + additional.length > 0) {
if (isOpenCommandUsed(command)) {
if (BrowserUtil.isOpenCommandSupportArgs()) {
command.addParameter("--args");
}
else {
LOG.warn("'open' command doesn't allow to pass command line arguments so they will be ignored: " +
StringUtil.join(specific, ", ") + " " + Arrays.toString(additional));
return;
}
}
command.addParameters(specific);
command.addParameters(additional);
}
}
示例14: createVirtualEnv
import com.intellij.execution.configurations.GeneralCommandLine; //導入依賴的package包/類
@NotNull
public static String createVirtualEnv(@NotNull String destinationDir, String version) throws ExecutionException {
final String condaExecutable = PyCondaPackageService.getCondaExecutable();
if (condaExecutable == null) throw new PyExecutionException("Cannot find conda", "Conda", Collections.<String>emptyList(), new ProcessOutput());
final ArrayList<String> parameters = Lists.newArrayList(condaExecutable, "create", "-p", destinationDir,
"python=" + version, "-y");
final GeneralCommandLine commandLine = new GeneralCommandLine(parameters);
final Process process = commandLine.createProcess();
final CapturingProcessHandler handler = new CapturingProcessHandler(process);
final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
final ProcessOutput result = handler.runProcessWithProgressIndicator(indicator);
if (result.isCancelled()) {
throw new RunCanceledByUserException();
}
final int exitCode = result.getExitCode();
if (exitCode != 0) {
final String message = StringUtil.isEmptyOrSpaces(result.getStdout()) && StringUtil.isEmptyOrSpaces(result.getStderr()) ?
"Permission denied" : "Non-zero exit code";
throw new PyExecutionException(message, "Conda", parameters, result);
}
final String binary = PythonSdkType.getPythonExecutable(destinationDir);
final String binaryFallback = destinationDir + File.separator + "bin" + File.separator + "python";
return (binary != null) ? binary : binaryFallback;
}
示例15: GitHandler
import com.intellij.execution.configurations.GeneralCommandLine; //導入依賴的package包/類
/**
* A constructor
*
* @param project a project
* @param directory a process directory
* @param command a command to execute (if empty string, the parameter is ignored)
*/
protected GitHandler(@NotNull Project project, @NotNull File directory, @NotNull GitCommand command) {
myProject = project;
myCommand = command;
myAppSettings = GitVcsApplicationSettings.getInstance();
myProjectSettings = GitVcsSettings.getInstance(myProject);
myEnv = new HashMap<String, String>(EnvironmentUtil.getEnvironmentMap());
myVcs = ObjectUtils.assertNotNull(GitVcs.getInstance(project));
myWorkingDirectory = directory;
myCommandLine = new GeneralCommandLine();
if (myAppSettings != null) {
myCommandLine.setExePath(myAppSettings.getPathToGit());
}
myCommandLine.setWorkDirectory(myWorkingDirectory);
if (GitVersionSpecialty.CAN_OVERRIDE_GIT_CONFIG_FOR_COMMAND.existsIn(myVcs.getVersion())) {
myCommandLine.addParameters("-c", "core.quotepath=false");
}
myCommandLine.addParameter(command.name());
myStdoutSuppressed = true;
mySilent = myCommand.lockingPolicy() == GitCommand.LockingPolicy.READ;
}