@@ -93,29 +93,21 @@ public function processContent(AssetFile $asset)
93
93
*/
94
94
protected function compileFile ($ filePath )
95
95
{
96
- $ nodeCmdArgs = $ this ->getNodeArgsAsArray ();
97
- $ lessCmdArgs = $ this ->getCompilerArgsAsArray ();
98
-
99
- $ cmd = '%s ' . str_repeat (' %s ' , count ($ nodeCmdArgs )) . ' %s ' . str_repeat (' %s ' , count ($ lessCmdArgs )) . ' %s ' ;
100
- $ arguments = [];
101
- $ arguments [] = $ this ->getPathToNodeBinary ();
102
- $ arguments = array_merge ($ arguments , $ nodeCmdArgs );
103
- $ arguments [] = $ this ->getPathToLessCompiler ();
104
- $ arguments = array_merge ($ arguments , $ lessCmdArgs );
105
- $ arguments [] = $ filePath ;
106
-
107
- // to log or not to log, that's the question
108
- // also, it would be better to use the logger in the Shell class,
109
- // since that one will contain the exact correct command, and not this sprintf version
110
- // $logArguments = array_map('escapeshellarg', $arguments);
111
- // $this->logger->debug('Less compilation command: `'
112
- // . sprintf($cmd, ...$logArguments)
113
- // . '`');
114
-
115
- return $ this ->shell ->execute (
116
- $ cmd ,
117
- $ arguments
118
- );
96
+ $ process = new \Symfony \Component \Process \Process ([
97
+ $ this ->getPathToNodeBinary (),
98
+ ...$ this ->getNodeArgsAsArray (),
99
+ $ this ->getPathToLessCompiler (),
100
+ ...$ this ->getCompilerArgsAsArray (),
101
+ $ filePath ,
102
+ ]);
103
+
104
+ $ process ->run ();
105
+
106
+ if (!$ process ->isSuccessful ()) {
107
+ throw new \Symfony \Component \Process \Exception \ProcessFailedException ($ process );
108
+ }
109
+
110
+ return $ process ->getOutput ();
119
111
}
120
112
121
113
/**
0 commit comments