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

Unified Diff: sdk/lib/_internal/pub/lib/src/command_runner.dart

Issue 1156663002: Escape arguments in pub error message command line reproduction. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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: sdk/lib/_internal/pub/lib/src/command_runner.dart
diff --git a/sdk/lib/_internal/pub/lib/src/command_runner.dart b/sdk/lib/_internal/pub/lib/src/command_runner.dart
index 96382da2b218b865dd7a81c9a573ee2c40314a31..ce0645d932b96a6ffcba6217b30ac8262baa599b 100644
--- a/sdk/lib/_internal/pub/lib/src/command_runner.dart
+++ b/sdk/lib/_internal/pub/lib/src/command_runner.dart
@@ -130,10 +130,12 @@ class PubCommandRunner extends CommandRunner {
if (options['trace']) {
log.dumpTranscript();
} else if (!isUserFacingException(error)) {
+ // TODO(23505): Implement proper shell escaping, not a partial hack.
+ protectArgument(String x) => x.contains(' ') ? '"$x"' : x;
nweiz 2015/05/22 20:01:34 Nit: don't type-annotate local variables, includin
log.error("""
This is an unexpected error. Please run
- pub --trace ${options.arguments.map((arg) => "'$arg'").join(' ')}
+ pub --trace ${options.arguments.map(protectArgument).join(' ')}
and include the results in a bug report on http://dartbug.com/new.
""");
« 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