Include command in ProcessException.
R=sgjesse@google.com
BUG=dartbug.com/4060
Review URL: https://codereview.chromium.org//11417028
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15010 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/runtime/bin/process_patch.dart b/runtime/bin/process_patch.dart
index ff99345..4cdc853 100644
--- a/runtime/bin/process_patch.dart
+++ b/runtime/bin/process_patch.dart
@@ -158,7 +158,10 @@
_err.close();
_exitHandler.close();
completer.completeException(
- new ProcessException(status._errorMessage, status._errorCode));
+ new ProcessException(_path,
+ _arguments,
+ status._errorMessage,
+ status._errorCode));
return;
}
_started = true;
@@ -245,7 +248,7 @@
void set onExit(void callback(int exitCode)) {
if (_ended) {
- throw new ProcessException("Process killed");
+ throw new ProcessException(_path, _arguments, "Process killed");
}
_onExit = callback;
}
diff --git a/sdk/lib/io/process.dart b/sdk/lib/io/process.dart
index 8d6d9f2..f2062df 100644
--- a/sdk/lib/io/process.dart
+++ b/sdk/lib/io/process.dart
@@ -214,8 +214,25 @@
class ProcessException implements Exception {
- const ProcessException([String this.message = "", int this.errorCode = 0]);
- String toString() => "ProcessException: $message ($errorCode)";
+ const ProcessException(String this.executable,
+ List<String> this.arguments,
+ [String this.message = "",
+ int this.errorCode = 0]);
+ String toString() {
+ var msg = (message == null) ? 'OS error code: $errorCode' : message;
+ var args = Strings.join(arguments, ' ');
+ return "ProcessException: $msg\n Command: $executable $args";
+ }
+
+ /**
+ * Contains the executable provided for the process.
+ */
+ final String executable;
+
+ /**
+ * Contains the arguments provided for the process.
+ */
+ final List<String> arguments;
/**
* Contains the system message for the process exception if any.