/**
* Prepares process builder for simple npm commands, e.g. "npm install" or "npm uninstall". Specific command should
* be passed without surrounding spaces or or quotes.
*
* @param invokationPath
* location on which npm command should be invoked
* @param packageName
* package passed as parameter to the command (might be space separated list of names)
* @param save
* instructs npm to save command result to packages in package.json (if available)
* @param simpleCommand
* command to execute
* @return configured, operating system aware process builder for given command
*/
private ProcessBuilder simpleCall(File invokationPath, String packageName, boolean save, String simpleCommand) {
Builder<String> builder = ImmutableList.<String> builder();
NpmBinary npmBinary = npmBinaryProvider.get();
String saveCommand = save ? NPM_OPTION_SAVE : "";
if (isWindows()) {
builder.add(WIN_SHELL_COMAMNDS);
builder.add(escapeBinaryPath(npmBinary.getBinaryAbsolutePath()), simpleCommand, packageName, saveCommand);
} else {
builder.add(NIX_SHELL_COMAMNDS);
builder.add(
escapeBinaryPath(npmBinary.getBinaryAbsolutePath()) + " " + simpleCommand + " " + packageName + " "
+ saveCommand);
}
return create(builder.build(), npmBinary, invokationPath, false);
}
NodeProcessBuilder.java 文件源码
java
阅读 41
收藏 0
点赞 0
评论 0
项目:n4js
作者:
评论列表
文章目录