我有以下片段代码(摘自较大的脚本):
Write-Output "Syncing $directory"
Push-Location $directory
git pull origin $branch
$directoryName = [IO.Path]::GetFileName($directory)
git log -n 1 --pretty=format:"%H %cd %aN%n%B" --date=short > "..\$directoryName.lastcommit.txt"
Pop-Location
在Windows Azure WebJob中运行时,偶尔(约50%的机会)会产生错误:
[05/06/2014 22:20:43 > e5e3ee: INFO] Syncing D:\home\site\!roslyn-sources\DeclarationExpressions
[05/06/2014 22:20:45 > e5e3ee: ERR ] From https://git01.codeplex.com/roslyn
[05/06/2014 22:20:45 > e5e3ee: ERR ] * branch DeclarationExpressions -> FETCH_HEAD
[05/06/2014 22:20:45 > e5e3ee: INFO] Already up-to-date.
[05/06/2014 22:20:45 > e5e3ee: INFO] [ERROR] Window title cannot be longer than 1023 characters.
[05/06/2014 22:20:45 > e5e3ee: INFO] Returning exit code 1
[05/06/2014 22:20:45 > e5e3ee: SYS INFO] Status changed to Failed
[05/06/2014 22:20:45 > e5e3ee: SYS ERR ] Job failed due to exit code 1
在本地运行时,我永远不会收到此错误。
可能是什么原因?
最佳答案
也许您正在运行的exe更改了窗口标题。
因此,与其直接在Powershell脚本中调用git
,不如使用cmdlet Start-Process
运行它
关于powershell - PowerShell Azure WebJob中的“Window title cannot be longer than 1023 characters”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23505677/