From e6ebbe0d20fe877b111cf4ccf8349cba129d6d3a Mon Sep 17 00:00:00 2001 From: Dmitri Shuralyov Date: Feb 04 2020 19:09:43 +0000 Subject: syscall: Revert "release a js.Func object in fsCall" This reverts CL 217417 (commit 753d56d3642eb83848aa39e65982a9fc77e722d7). This change was unintentionally submitted to master during the Go 1.14 code freeze; it should be sent again for Go 1.15. Change-Id: Ie790342f227ae3adfc5f9a90ce3abdc2c9be619b Reviewed-on: https://go-review.googlesource.com/c/go/+/217721 Run-TryBot: Dmitri Shuralyov Reviewed-by: Carlos Amedee --- diff --git a/src/syscall/fs_js.go b/src/syscall/fs_js.go index c1cac97..16d9f58 100644 --- a/src/syscall/fs_js.go +++ b/src/syscall/fs_js.go @@ -495,7 +495,7 @@ func fsCall(name string, args ...interface{}) (js.Value, error) { } c := make(chan callResult, 1) - f := js.FuncOf(func(this js.Value, args []js.Value) interface{} { + jsFS.Call(name, append(args, js.FuncOf(func(this js.Value, args []js.Value) interface{} { var res callResult if len(args) >= 1 { // on Node.js 8, fs.utimes calls the callback without any arguments @@ -511,9 +511,7 @@ func fsCall(name string, args ...interface{}) (js.Value, error) { c <- res return nil - }) - defer f.Release() - jsFS.Call(name, append(args, f)...) + }))...) res := <-c return res.val, res.err }