Skip to content

Commit 23aa25f

Browse files
committed
darwin fix
1 parent 66fbe53 commit 23aa25f

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/os/exec_posix.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris || wasip1 || wasip2 || windows
5+
//go:build aix || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris || wasip1 || windows
66

77
package os
88

src/syscall/str.go

+19
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,22 @@ func ByteSliceFromString(s string) ([]byte, error) {
5151
copy(a, s)
5252
return a, nil
5353
}
54+
55+
func SlicePtrFromStrings(ss []string) ([]*byte, error) {
56+
n := 0
57+
for _, s := range ss {
58+
if IndexByteString(s, 0) != -1 {
59+
return nil, EINVAL
60+
}
61+
n += len(s) + 1 // +1 for NUL
62+
}
63+
bb := make([]*byte, len(ss)+1)
64+
b := make([]byte, n)
65+
n = 0
66+
for i, s := range ss {
67+
bb[i] = &b[n]
68+
copy(b[n:], s)
69+
n += len(s) + 1
70+
}
71+
return bb, nil
72+
}

0 commit comments

Comments
 (0)