Skip to content

Commit c261aed

Browse files
pmeinhardtandreasknoepfle
authored andcommitted
Make :erl_tar.init/3 arguments clearer
1 parent dd52dd9 commit c261aed

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

examples/tarpipe.exs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ ctx =
55
|> SSHKit.Context.path("/tmp")
66
|> SSHKit.Context.user("other")
77
|> SSHKit.Context.group("other")
8+
|> SSHKit.Context.umask("0077")
89

910
defmodule Xfer do
1011
# https://github.com/erlang/otp/blob/OTP-23.2.1/lib/ssh/src/ssh.hrl
@@ -28,16 +29,16 @@ end
2829
# In case of failed upload, check command output:
2930
# IO.inspect(SSHKit.Channel.recv(chan))
3031

31-
{:ok, tar} = :erl_tar.init(self(), :write, fn
32-
:position, {_, position} ->
32+
{:ok, tar} = :erl_tar.init(chan, :write, fn
33+
:position, {^chan, position} ->
3334
# IO.write("tar position: #{inspect(position)}")
3435
{:ok, 0}
3536

36-
:write, {_, data} ->
37+
:write, {^chan, data} ->
3738
:ok = SSHKit.Channel.send(chan, Xfer.to_binary(data))
3839
:ok
3940

40-
:close, _ ->
41+
:close, ^chan ->
4142
:ok = SSHKit.Channel.eof(chan)
4243
:ok
4344
end)

0 commit comments

Comments
 (0)