TODO: defer workaround, should remove after fix

This commit is contained in:
Li Jie
2025-04-11 17:14:26 +08:00
parent 5a13e7400e
commit 19b98393a6
4 changed files with 10 additions and 4 deletions

View File

@@ -80,7 +80,7 @@ func (p *pipe) write(b []byte) (n int, err error) {
return 0, p.writeCloseError()
default:
p.wrMu.Lock()
defer p.wrMu.Unlock()
//TODO(lijie): workaround for defer crash on wasm
}
for once := true; once || len(b) > 0; once = false {
@@ -90,9 +90,11 @@ func (p *pipe) write(b []byte) (n int, err error) {
b = b[nw:]
n += nw
case <-p.done:
p.wrMu.Unlock()
return n, p.writeCloseError()
}
}
p.wrMu.Unlock()
return n, nil
}