Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1456)

Unified Diff: tools/gardening/lib/src/logdog.dart

Issue 2797253006: Add find_timeouts and caching to tools/gardening (Closed)
Patch Set: Updated cf. comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gardening/lib/src/cache.dart ('k') | tools/gardening/lib/src/util.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gardening/lib/src/logdog.dart
diff --git a/tools/gardening/lib/src/logdog.dart b/tools/gardening/lib/src/logdog.dart
index 776d4fbb815125e5729be7628f6d52ed7b81c0fd..c18d539314293da901834b715e82db6b38659d8c 100644
--- a/tools/gardening/lib/src/logdog.dart
+++ b/tools/gardening/lib/src/logdog.dart
@@ -6,6 +6,8 @@ import 'dart:io';
import 'dart:async';
import 'dart:collection';
+final String cit = Platform.isWindows ? 'cit.bat' : 'cit';
+
class LogdogException implements Exception {
final int errorCode;
final String stdout;
@@ -22,7 +24,7 @@ bool logdogCheckDone = false;
void checkLogdog({bool tryToInstall: true}) {
if (logdogCheckDone) return;
- var result = Process.runSync("cit", []);
+ var result = Process.runSync(cit, []);
if (result.exitCode != 0) {
print("cit (from depot_tools) must be in the path.");
throw new StateError("cit not accessible");
@@ -34,7 +36,7 @@ void checkLogdog({bool tryToInstall: true}) {
}
if (tryToInstall) {
print("logdog isn't yet installed. Installation might take some time");
- result = Process.runSync("cit", ["logdog"]);
+ result = Process.runSync(cit, ["logdog"]);
checkLogdog(tryToInstall: false);
} else {
print("Couldn't install logdog");
@@ -45,7 +47,7 @@ void checkLogdog({bool tryToInstall: true}) {
String logdog(List<String> args) {
checkLogdog();
args = args.toList()..insert(0, "logdog");
- var result = Process.runSync("cit", args);
+ var result = Process.runSync(cit, args);
if (result.exitCode == 0) return result.stdout;
throw new LogdogException.fromProcessResult(result);
}
@@ -54,6 +56,13 @@ String cat(String log) {
return logdog(["cat", "-raw", log]);
}
+/// Returns the content for [path], for instance the available build numbers
+/// for 'dart2js-linux-chromeff-1-4-be' using the path
+/// `chromium/bb/client.dart/dart2js-linux-chromeff-1-4-be`.
+String ls(String path) {
+ return logdog(["ls", path]);
+}
+
class LogResult<T> {
final String log;
final T result;
@@ -80,11 +89,11 @@ Stream<LogResult<String>> catN(Iterable<String> logs) async* {
var log = it.current;
queue.add(new Future.sync(() async {
var logPath = log.substring(0, log.lastIndexOf("/"));
- var lsResult = await Process.run("cit", ["logdog", "ls", logPath]);
+ var lsResult = await Process.run(cit, ["logdog", "ls", logPath]);
if (lsResult.exitCode != 0) return new LogResult(log, lsResult);
if (lsResult.stdout == "") return new LogResult(log, null);
return new LogResult(
- log, await Process.run("cit", ["logdog", "cat", "-raw", log]));
+ log, await Process.run(cit, ["logdog", "cat", "-raw", log]));
}));
return true;
}
@@ -124,4 +133,4 @@ main() async {
}
});
}
-*/
+*/
« no previous file with comments | « tools/gardening/lib/src/cache.dart ('k') | tools/gardening/lib/src/util.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698