unix: add Exec call

The syscall execve has no wrapper in this library, which it seems like
it should - Ian seemed to concur in CL 72550.

Add a docstring and an example, because I always get confused about
how to invoke the syscall.

Change-Id: I6100bbbf4ace9e3e341bf186a04cc03301da9aea
Reviewed-on: https://go-review.googlesource.com/101282
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Kevin Burke
2018-03-18 18:50:30 +00:00
parent 2f1e207ee3
commit 0deb464c5a
2 changed files with 25 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package unix
import (
"log"
"os"
"syscall"
)
func ExampleExec() {
err := syscall.Exec("/bin/ls", []string{"ls", "-al"}, os.Environ())
log.Fatal(err)
}