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

Unified Diff: tools/testing/dart/version.dart

Issue 11090066: Spekulative fix for version.dart on windows (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/dart/version.dart
===================================================================
--- tools/testing/dart/version.dart (revision 13469)
+++ tools/testing/dart/version.dart (working copy)
@@ -95,14 +95,14 @@
if (!c.future.isComplete) {
getRevision().then((revision) {
REVISION = revision;
- getUserName().then((username) {
- USERNAME = username;
- if (username != '') username = "_$username";
- var revisionString = "";
- if (revision != 0) revisionString = "_r$revision";
- c.complete("$MAJOR.$MINOR.$BUILD.$PATCH$revisionString$username");
- return;
- });
+ USERNAME = getUserName();
+ var userNameString = "";
+ if (USERNAME != '') userNameString = "_$USERNAME";
+ var revisionString = "";
+ if (revision != 0) revisionString = "_r$revision";
+ c.complete(
+ "$MAJOR.$MINOR.$BUILD.$PATCH$revisionString$userNameString");
+ return;
});
}
};
@@ -110,12 +110,20 @@
return c.future;
}
+ String getExecutableSuffix() {
+ if (Platform.operatingSystem == 'windows') {
+ return '.exe';
+ }
+ return '';
+ }
+
Future<int> getRevision() {
if (repositoryType == RepositoryType.UNKNOWN) {
return new Future.immediate(0);
}
var isSvn = repositoryType == RepositoryType.SVN;
var command = isSvn ? "svn" : "git";
+ command = "$command${getExecutableSuffix()}";
var arguments = isSvn ? ["info"] : ["svn", "info"];
return Process.run(command, arguments).transform((result) {
if (result.exitCode != 0) {
@@ -133,17 +141,10 @@
});
}
- Future<String> getUserName() {
+ String getUserName() {
// TODO(ricow): Don't add this on the buildbot.
- // If we can't get the username simple return "" (e.g. on windows).
- return Process.run("whoami", []).transform((result) {
- if (result.exitCode != 0) {
- return "";
- }
- return result.stdout;
- }).transformException((e) {
- return "";
- });
+ if (!Platform.environment.containsKey("USER")) return "";
+ return Platform.environment["USER"];
}
RepositoryType get repositoryType {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698