News for hackers. Stuff that matters.
Re:Elixir – Why the dot (when calling anonymous functions)? by minitech on Monday August 14, 2023 @05:57PM (#37127310)
> The bug is that there's not a closure around the ssh instance, so if you call this function multiple times it'll actually return the same connection instance.

I’m not entirely sure what you mean by this, but it doesn’t sound like a correct diagnosis. Each call to `getSFTPConnection` creates a new `ssh2.Client` instance (unless `ssh2.Client`’s constructor does something weird), and the promise can only resolve with the value `ssh.sftp` passes (although there’s a missing error check).

Re:Elixir – Why the dot (when calling anonymous functions)? by claytongulick on Monday August 14, 2023 @08:10PM (#37128478)
Yes, you're 100% correct, I mixed some stuff up when I was posting the code for simplicity.

Bad example!