- $cmd = wfEscapeShellArg( $wgJpegTran ) .
- " -rotate " . wfEscapeShellArg( $rotation ) .
- " -outfile " . wfEscapeShellArg( $params['dstPath'] ) .
- " " . wfEscapeShellArg( $params['srcPath'] );
- wfDebug( __METHOD__ . ": running jpgtran: $cmd\n" );
- $retval = 0;
- $err = wfShellExecWithStderr( $cmd, $retval );
- if ( $retval !== 0 ) {
- $this->logErrorForExternalProcess( $retval, $err, $cmd );
-
- return new MediaTransformError( 'thumbnail_error', 0, 0, $err );
+ $command = Shell::command( $wgJpegTran,
+ '-rotate',
+ $rotation,
+ '-outfile',
+ $params['dstPath'],
+ $params['srcPath']
+ );
+ $result = $command
+ ->includeStderr()
+ ->execute();
+ if ( $result->getExitCode() !== 0 ) {
+ $this->logErrorForExternalProcess( $result->getExitCode(),
+ $result->getStdout(),
+ $command
+ );
+
+ return new MediaTransformError( 'thumbnail_error', 0, 0, $result->getStdout() );