本文整理了Java中org.eclipse.jgit.util.FS.runInShell()
方法的一些代码示例,展示了FS.runInShell()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FS.runInShell()
方法的具体详情如下:
包路径:org.eclipse.jgit.util.FS
类名称:FS
方法名:runInShell
[英]Initialize a ProcessBuilder to run a command using the system shell.
[中]使用系统外壳初始化ProcessBuilder以运行命令。
代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit
/**
* Spawn process
*
* @param cmd
* command
* @return a {@link java.lang.Process} object.
* @throws org.eclipse.jgit.errors.TransportException
* if any.
*/
protected Process spawn(String cmd)
throws TransportException {
try {
String[] args = { "." }; //$NON-NLS-1$
ProcessBuilder proc = local.getFS().runInShell(cmd, args);
proc.directory(remoteGitDir);
// Remove the same variables CGit does.
Map<String, String> env = proc.environment();
env.remove("GIT_ALTERNATE_OBJECT_DIRECTORIES"); //$NON-NLS-1$
env.remove("GIT_CONFIG"); //$NON-NLS-1$
env.remove("GIT_CONFIG_PARAMETERS"); //$NON-NLS-1$
env.remove("GIT_DIR"); //$NON-NLS-1$
env.remove("GIT_WORK_TREE"); //$NON-NLS-1$
env.remove("GIT_GRAFT_FILE"); //$NON-NLS-1$
env.remove("GIT_INDEX_FILE"); //$NON-NLS-1$
env.remove("GIT_NO_REPLACE_OBJECTS"); //$NON-NLS-1$
return proc.start();
} catch (IOException err) {
throw new TransportException(uri, err.getMessage(), err);
}
}
代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit
final String cmd = relativize(runDirectory.getAbsolutePath(),
hookPath);
ProcessBuilder hookProcess = runInShell(cmd, args);
hookProcess.directory(runDirectory);
Map<String, String> environment = hookProcess.environment();
代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit
CheckoutMetadata checkoutMetadata, ObjectLoader ol, FS fs,
OutputStream channel) throws IOException {
ProcessBuilder filterProcessBuilder = fs.runInShell(
checkoutMetadata.smudgeFilterCommand, new String[0]);
filterProcessBuilder.directory(repo.getWorkTree());
代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit
ProcessBuilder filterProcessBuilder = fs.runInShell(filterCommand,
new String[0]);
filterProcessBuilder.directory(repository.getWorkTree());
代码示例来源:origin: sonia.jgit/org.eclipse.jgit
protected Process spawn(final String cmd)
throws TransportException {
try {
String[] args = { "." }; //$NON-NLS-1$
ProcessBuilder proc = local.getFS().runInShell(cmd, args);
proc.directory(remoteGitDir);
// Remove the same variables CGit does.
Map<String, String> env = proc.environment();
env.remove("GIT_ALTERNATE_OBJECT_DIRECTORIES"); //$NON-NLS-1$
env.remove("GIT_CONFIG"); //$NON-NLS-1$
env.remove("GIT_CONFIG_PARAMETERS"); //$NON-NLS-1$
env.remove("GIT_DIR"); //$NON-NLS-1$
env.remove("GIT_WORK_TREE"); //$NON-NLS-1$
env.remove("GIT_GRAFT_FILE"); //$NON-NLS-1$
env.remove("GIT_INDEX_FILE"); //$NON-NLS-1$
env.remove("GIT_NO_REPLACE_OBJECTS"); //$NON-NLS-1$
return proc.start();
} catch (IOException err) {
throw new TransportException(uri, err.getMessage(), err);
}
}
代码示例来源:origin: berlam/github-bucket
/**
* Spawn process
*
* @param cmd
* command
* @return a {@link java.lang.Process} object.
* @throws org.eclipse.jgit.errors.TransportException
* if any.
*/
protected Process spawn(String cmd)
throws TransportException {
try {
String[] args = { "." }; //$NON-NLS-1$
ProcessBuilder proc = local.getFS().runInShell(cmd, args);
proc.directory(remoteGitDir);
// Remove the same variables CGit does.
Map<String, String> env = proc.environment();
env.remove("GIT_ALTERNATE_OBJECT_DIRECTORIES"); //$NON-NLS-1$
env.remove("GIT_CONFIG"); //$NON-NLS-1$
env.remove("GIT_CONFIG_PARAMETERS"); //$NON-NLS-1$
env.remove("GIT_DIR"); //$NON-NLS-1$
env.remove("GIT_WORK_TREE"); //$NON-NLS-1$
env.remove("GIT_GRAFT_FILE"); //$NON-NLS-1$
env.remove("GIT_INDEX_FILE"); //$NON-NLS-1$
env.remove("GIT_NO_REPLACE_OBJECTS"); //$NON-NLS-1$
return proc.start();
} catch (IOException err) {
throw new TransportException(uri, err.getMessage(), err);
}
}
代码示例来源:origin: berlam/github-bucket
final String cmd = relativize(runDirectory.getAbsolutePath(),
hookPath);
ProcessBuilder hookProcess = runInShell(cmd, args);
hookProcess.directory(runDirectory);
Map<String, String> environment = hookProcess.environment();
代码示例来源:origin: sonia.jgit/org.eclipse.jgit
final String cmd = relativize(runDirectory.getAbsolutePath(),
hookPath);
ProcessBuilder hookProcess = runInShell(cmd, args);
hookProcess.directory(runDirectory);
try {
代码示例来源:origin: berlam/github-bucket
CheckoutMetadata checkoutMetadata, ObjectLoader ol, FS fs,
OutputStream channel) throws IOException {
ProcessBuilder filterProcessBuilder = fs.runInShell(
checkoutMetadata.smudgeFilterCommand, new String[0]);
filterProcessBuilder.directory(repo.getWorkTree());
代码示例来源:origin: sonia.jgit/org.eclipse.jgit
private InputStream filterClean(InputStream in, OperationType opType)
throws IOException {
in = handleAutoCRLF(in, opType);
String filterCommand = getCleanFilterCommand();
if (filterCommand != null) {
FS fs = repository.getFS();
ProcessBuilder filterProcessBuilder = fs.runInShell(filterCommand,
new String[0]);
filterProcessBuilder.directory(repository.getWorkTree());
filterProcessBuilder.environment().put(Constants.GIT_DIR_KEY,
repository.getDirectory().getAbsolutePath());
ExecutionResult result;
try {
result = fs.execute(filterProcessBuilder, in);
} catch (IOException | InterruptedException e) {
throw new IOException(new FilterFailedException(e,
filterCommand, getEntryPathString()));
}
int rc = result.getRc();
if (rc != 0) {
throw new IOException(new FilterFailedException(rc,
filterCommand, getEntryPathString(),
result.getStdout().toByteArray(MAX_EXCEPTION_TEXT_SIZE),
RawParseUtils.decode(result.getStderr()
.toByteArray(MAX_EXCEPTION_TEXT_SIZE))));
}
return result.getStdout().openInputStream();
}
return in;
}
代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit.lfs
/** {@inheritDoc} */
@Override
public Void call() throws Exception {
StoredConfig cfg = null;
if (repository == null) {
cfg = loadUserConfig();
} else {
cfg = repository.getConfig();
}
cfg.setBoolean(ConfigConstants.CONFIG_FILTER_SECTION,
ConfigConstants.CONFIG_SECTION_LFS,
ConfigConstants.CONFIG_KEY_USEJGITBUILTIN, true);
cfg.setBoolean(ConfigConstants.CONFIG_FILTER_SECTION,
ConfigConstants.CONFIG_SECTION_LFS,
ConfigConstants.CONFIG_KEY_REQUIRED, true);
cfg.save();
// try to run git lfs install, we really don't care if it is present
// and/or works here (yet).
ProcessBuilder builder = FS.DETECTED.runInShell("git", //$NON-NLS-1$
repository == null ? ARGS_USER : ARGS_LOCAL);
if (repository != null) {
builder.directory(repository.isBare() ? repository.getDirectory()
: repository.getWorkTree());
}
FS.DETECTED.runProcess(builder, null, null, (String) null);
return null;
}
代码示例来源:origin: berlam/github-bucket
ProcessBuilder filterProcessBuilder = fs.runInShell(filterCommand,
new String[0]);
filterProcessBuilder.directory(repository.getWorkTree());
代码示例来源:origin: sonia.jgit/org.eclipse.jgit
new FileOutputStream(tmpFile), nonNullEolStreamType);
if (checkoutMetadata.smudgeFilterCommand != null) {
ProcessBuilder filterProcessBuilder = fs.runInShell(
checkoutMetadata.smudgeFilterCommand, new String[0]);
filterProcessBuilder.directory(repo.getWorkTree());
内容来源于网络,如有侵权,请联系作者删除!