gojs: implements umask (#1230)

This implements host-side umask for gojs, which allows
`os.TestMkdirStickyUmask` to pass.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
Crypt Keeper
2023-03-14 08:01:50 +08:00
committed by GitHub
parent c45f0ef062
commit ec6a054119
8 changed files with 166 additions and 97 deletions

View File

@@ -24,6 +24,7 @@ func NewState(ctx context.Context) *State {
values: values.NewValues(),
valueGlobal: newJsGlobal(getRoundTripper(ctx)),
cwd: getWorkdir(ctx),
umask: 0o0022,
_nextCallbackTimeoutID: 1,
_scheduledTimeouts: map[uint32]chan bool{},
}
@@ -190,6 +191,8 @@ type State struct {
// cwd is initially "/"
cwd string
// umask is initially 0022
umask uint32
}
// Get implements the same method as documented on goos.GetFunction
@@ -226,6 +229,7 @@ func (s *State) close() {
s._lastEvent = nil
s._nextCallbackTimeoutID = 1
s.cwd = "/"
s.umask = 0o0022
}
func toInt64(arg interface{}) int64 {