Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2649482
D25341.1732487003.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
D25341.1732487003.diff
View Options
diff --git a/src/filesystem/Filesystem.php b/src/filesystem/Filesystem.php
--- a/src/filesystem/Filesystem.php
+++ b/src/filesystem/Filesystem.php
@@ -1103,12 +1103,23 @@
}
return null;
}
- $stdout = head($stdout);
+
+ // These are the only file extensions that can be executed directly
+ // when using proc_open() with 'bypass_shell'.
+ $executable_extensions = ['exe', 'bat', 'cmd', 'com'];
+
+ foreach ($stdout as $line) {
+ $path = trim($line);
+ $ext = pathinfo($path, PATHINFO_EXTENSION);
+ if (in_array($ext, $executable_extensions)) {
+ return $path;
+ }
+ }
+ return null;
} else {
list($err, $stdout) = exec_manual('which %s', $binary);
+ return $err === 0 ? trim($stdout) : null;
}
-
- return $err === 0 ? trim($stdout) : null;
}
diff --git a/src/lint/linter/ArcanistExternalLinter.php b/src/lint/linter/ArcanistExternalLinter.php
--- a/src/lint/linter/ArcanistExternalLinter.php
+++ b/src/lint/linter/ArcanistExternalLinter.php
@@ -133,7 +133,19 @@
* @task bin
*/
final public function getBinary() {
- return coalesce($this->bin, $this->getDefaultBinary());
+ $bin = coalesce($this->bin, $this->getDefaultBinary());
+ if (phutil_is_windows()) {
+ // On Windows, we use proc_open with 'bypass_shell' option, which will
+ // resolve %PATH%, but not %PATHEXT% (unless the extension is .exe).
+ // Therefore find the right binary ourselves.
+ // If we can't find it, leave it unresolved, as this string will be
+ // used in some error messages elsewhere.
+ $resolved = Filesystem::resolveBinary($bin);
+ if ($resolved) {
+ return $resolved;
+ }
+ }
+ return $bin;
}
/**
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 22:23 (2 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
992889
Default Alt Text
D25341.1732487003.diff (1 KB)
Attached To
Mode
D25341: Fix ArcanistExternalLinter on Windows
Attached
Detach File
Event Timeline
Log In to Comment