-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGet-AutoNinjaLog.ps1
More file actions
43 lines (38 loc) · 1.19 KB
/
Copy pathGet-AutoNinjaLog.ps1
File metadata and controls
43 lines (38 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
[CmdletBinding()]
param(
$Path,
[switch] $Watch);
# find the most recently run folder under gitRoot\out
$buildLogPath = (Get-ChildItem @(
"$Path\out\*\siso_output",
"$Path\out\*\build.log") -File -ErrorAction Ignore |
Sort-Object LastWriteTime -Descending |
Select-Object -First 1
).FullName;
Write-Verbose "BuildLogPath: $buildLogPath";
if (!(Test-Path $buildLogPath)) {
$thisScriptPath = $MyInvocation.MyCommand.Path;
"$thisScriptPath (1,1): error: $buildLogPath not found";
exit 1;
} else {
if (!($Watch)) {
findstr "error info warning note" "$buildLogPath"
} else {
$previousDate = $null;
$currentDate = $null;
do {
$currentDate = (Get-ChildItem $buildLogPath).LastWriteTime;
Write-Host -NoNewline ".";
if ($previousDate -ne $currentDate) {
$previousDate = $currentDate;
"";
"---START LOG note---";
Get-Content $buildLogPath;
"---END LOG note---";
"--$($currentDate)--";
} else {
Start-Sleep -Seconds 1;
}
} while ($true);
}
}