]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Use Filesystem::getMimeType() in Arcanist
authorepriestley <git@epriestley.com>
Fri, 27 Apr 2012 19:48:47 +0000 (12:48 -0700)
committerepriestley <git@epriestley.com>
Fri, 27 Apr 2012 19:48:47 +0000 (12:48 -0700)
Summary: Missed this when getting rid of all the 'file' calls.

Test Plan: Meta.

Reviewers: btrahan, vrana, jungejason

Reviewed By: vrana

CC: aran
Maniphest Tasks: T1159

Differential Revision: https://secure.phabricator.com/D2327

src/workflow/diff/ArcanistDiffWorkflow.php
src/workflow/diff/__init__.php

index 3e602793cc4cb1835399d673b0826af374e0dfb0..3db0f813696109dff157bc660a2193603655a4f1 100644 (file)
@@ -898,11 +898,9 @@ EOTEXT
       return $result;
     }
 
-    $future = new ExecFuture('file -b --mime -');
-    $future->write($data);
-    list($mime_type) = $future->resolvex();
-
-    $mime_type = trim($mime_type);
+    $tmp = new TempFile();
+    Filesystem::writeFile($tmp, $data);
+    $mime_type = Filesystem::getMimeType($tmp);
     $result['mime'] = $mime_type;
 
     echo "Uploading {$desc} '{$name}' ({$mime_type}, {$size} bytes)...\n";
index db89e37ad82f5644949c8310ad4f533dbc68aefe..ec97b7581726744b4774d6c0094552b6a0b8339f 100644 (file)
@@ -23,6 +23,7 @@ phutil_require_module('phutil', 'console');
 phutil_require_module('phutil', 'console/editor');
 phutil_require_module('phutil', 'filesystem');
 phutil_require_module('phutil', 'filesystem/filelist');
+phutil_require_module('phutil', 'filesystem/tempfile');
 phutil_require_module('phutil', 'future/exec');
 phutil_require_module('phutil', 'utils');