Mic*_*cah 7 git powershell asynchronous nonblocking
我正在编写一个PowerShell脚本,需要同时将代码推送到几个git存储库?
这是我到目前为止的脚本:
param(
[parameter(Mandatory=$true)]
[string]$repoPath,
[parameter(Mandatory=$true)]
[array]$remoteRepos
)
pushd $repoPath
$remoteRepos | % {
#Want to exexcute this without blocking
& git push $_ master --fore -v
}
popd
Run Code Online (Sandbox Code Playgroud)
这是我执行脚本的方式:
gitdeploy.ps1 -repoPath c:\code\myrepo -remoteRepos repo1,repo2
Run Code Online (Sandbox Code Playgroud)
如何以& git push $_ master --fore -v非阻塞的方式执行?
解
感谢@Jamey的解决方案.我执行了这个命令:
Start-Process "cmd.exe" "/c git push $_ master --force -v"
Run Code Online (Sandbox Code Playgroud)
您还可以使用start-process在其他命令窗口中运行每个推送.
start-process -FilePath "git" -ArgumentList ("push", $_, "master", "--fore", "-v")
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3663 次 |
| 最近记录: |