projects
/
akkoma
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
aa0a5ff
)
Fix truncated images
author
href
<href+git-pleroma@random.sh>
Fri, 21 Aug 2020 17:02:57 +0000
(17:02 +0000)
committer
href
<href+git-pleroma@random.sh>
Fri, 21 Aug 2020 17:02:57 +0000
(17:02 +0000)
lib/pleroma/helpers/media_helper.ex
patch
|
blob
|
history
diff --git
a/lib/pleroma/helpers/media_helper.ex
b/lib/pleroma/helpers/media_helper.ex
index e11038052d6bd5df2c99c91617bf13cfd85901ac..f87be8874737969ea83af1047fab9b5c32725d45 100644
(file)
--- a/
lib/pleroma/helpers/media_helper.ex
+++ b/
lib/pleroma/helpers/media_helper.ex
@@
-19,14
+19,24
@@
defmodule Pleroma.Helpers.MediaHelper do
"""
pid = Port.open({:spawn, cmd}, [:use_stdio, :in, :stream, :exit_status, :binary])
+ loop_recv(pid)
+ end
+
+ defp loop_recv(pid) do
+ loop_recv(pid, <<>>)
+ end
+ defp loop_recv(pid, acc) do
receive do
{^pid, {:data, data}} ->
- send(pid, {self(), :close})
- {:ok, data}
+ loop_recv(pid, acc <> data)
- {^pid, {:exit_status, status}} when status > 0 ->
+ {^pid, {:exit_status, 0}} ->
+ {:ok, acc}
+
+ {^pid, {:exit_status, status}} ->
{:error, status}
end
end
+
end