projects
/
akkoma
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5453038
)
Just validate command is in PATH; forking a shell is wasteful
author
Mark Felder
<feld@feld.me>
Thu, 14 Jan 2021 22:58:18 +0000
(16:58 -0600)
committer
Mark Felder
<feld@feld.me>
Thu, 14 Jan 2021 23:19:02 +0000
(17:19 -0600)
lib/pleroma/utils.ex
patch
|
blob
|
history
diff --git
a/lib/pleroma/utils.ex
b/lib/pleroma/utils.ex
index fa75a8c9930426ae7f5473d7dc3c0ce0b2f3db9f..fae7657d9714fafa6ae23d9715c6e399a121f3bd 100644
(file)
--- a/
lib/pleroma/utils.ex
+++ b/
lib/pleroma/utils.ex
@@
-30,7
+30,10
@@
defmodule Pleroma.Utils do
"""
@spec command_available?(String.t()) :: boolean()
def command_available?(command) do
- match?({_output, 0}, System.cmd("sh", ["-c", "command -v #{command}"]))
+ case :os.find_executable(String.to_charlist(command)) do
+ false -> false
+ _ -> true
+ end
end
@doc "creates the uniq temporary directory"