let outputBuf = "";
global.fs = {
- constants: { O_WRONLY: -1, O_RDWR: -1, O_CREAT: -1, O_TRUNC: -1, O_APPEND: -1, O_EXCL: -1, O_NONBLOCK: -1, O_SYNC: -1 }, // unused
+ constants: { O_WRONLY: -1, O_RDWR: -1, O_CREAT: -1, O_TRUNC: -1, O_APPEND: -1, O_EXCL: -1 }, // unused
writeSync(fd, buf) {
outputBuf += decoder.decode(buf);
const nl = outputBuf.lastIndexOf("\n");
package syscall
import (
+ "errors"
"io"
"sync"
"syscall/js"
var constants = jsFS.Get("constants")
var (
- nodeWRONLY = constants.Get("O_WRONLY").Int()
- nodeRDWR = constants.Get("O_RDWR").Int()
- nodeCREATE = constants.Get("O_CREAT").Int()
- nodeTRUNC = constants.Get("O_TRUNC").Int()
- nodeAPPEND = constants.Get("O_APPEND").Int()
- nodeEXCL = constants.Get("O_EXCL").Int()
- nodeNONBLOCK = constants.Get("O_NONBLOCK").Int()
- nodeSYNC = constants.Get("O_SYNC").Int()
+ nodeWRONLY = constants.Get("O_WRONLY").Int()
+ nodeRDWR = constants.Get("O_RDWR").Int()
+ nodeCREATE = constants.Get("O_CREAT").Int()
+ nodeTRUNC = constants.Get("O_TRUNC").Int()
+ nodeAPPEND = constants.Get("O_APPEND").Int()
+ nodeEXCL = constants.Get("O_EXCL").Int()
)
type jsFile struct {
if openmode&O_EXCL != 0 {
flags |= nodeEXCL
}
- if openmode&O_NONBLOCK != 0 {
- flags |= nodeNONBLOCK
- }
if openmode&O_SYNC != 0 {
- flags |= nodeSYNC
+ return 0, errors.New("syscall.Open: O_SYNC is not supported by js/wasm")
}
jsFD, err := fsCall("openSync", path, flags, perm)