@@ -48,7 +48,7 @@ public function run(OutputInterface $output, $cmd, $error = null, $callback = nu
48
48
}
49
49
50
50
if ($ verbosity <= $ output ->getVerbosity ()) {
51
- $ output ->write ($ formatter ->start (spl_object_hash ($ process ), $ process ->getCommandLine ()));
51
+ $ output ->write ($ formatter ->start (spl_object_hash ($ process ), $ this -> escapeString ( $ process ->getCommandLine () )));
52
52
}
53
53
54
54
if ($ output ->isDebug ()) {
@@ -63,7 +63,7 @@ public function run(OutputInterface $output, $cmd, $error = null, $callback = nu
63
63
}
64
64
65
65
if (!$ process ->isSuccessful () && null !== $ error ) {
66
- $ output ->writeln (sprintf ('<error>%s</error> ' , $ error ));
66
+ $ output ->writeln (sprintf ('<error>%s</error> ' , $ this -> escapeString ( $ error) ));
67
67
}
68
68
69
69
return $ process ;
@@ -111,15 +111,26 @@ public function wrapCallback(OutputInterface $output, Process $process, $callbac
111
111
{
112
112
$ formatter = $ this ->getHelperSet ()->get ('debug_formatter ' );
113
113
114
- return function ($ type , $ buffer ) use ($ output , $ process , $ callback , $ formatter ) {
115
- $ output ->write ($ formatter ->progress (spl_object_hash ($ process ), $ buffer , Process::ERR === $ type ));
114
+ $ that = $ this ;
115
+ return function ($ type , $ buffer ) use ($ output , $ process , $ callback , $ formatter , $ that ) {
116
+ $ output ->write ($ formatter ->progress (spl_object_hash ($ process ), $ that ->escapeString ($ buffer ), Process::ERR === $ type ));
116
117
117
118
if (null !== $ callback ) {
118
119
call_user_func ($ callback , $ type , $ buffer );
119
120
}
120
121
};
121
122
}
122
123
124
+ /**
125
+ * This method is public for PHP 5.3 compatibility, it should be private.
126
+ *
127
+ * @internal
128
+ */
129
+ public function escapeString ($ str )
130
+ {
131
+ return str_replace ('< ' , '\\< ' , $ str );
132
+ }
133
+
123
134
/**
124
135
* {@inheritdoc}
125
136
*/
0 commit comments