https://github.com/codeskyblue/exec
An implement of os/exec, but add timeout option
https://github.com/codeskyblue/exec
Last synced: about 2 months ago
JSON representation
An implement of os/exec, but add timeout option
- Host: GitHub
- URL: https://github.com/codeskyblue/exec
- Owner: codeskyblue
- License: gpl-3.0
- Created: 2013-05-28T10:37:32.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2013-07-29T07:56:01.000Z (almost 12 years ago)
- Last Synced: 2025-01-26T01:18:17.542Z (4 months ago)
- Language: Go
- Size: 164 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
exec
====
[](https://drone.io/github.com/shxsun/exec/latest)An implement of os/exec, but add timeout option
## Example
package main
import (
"fmt"
"github.com/shxsun/exec"
"time"
)func main() {
cmd := exec.Command("sleep", "2")
cmd.Timeout = time.Second * 1
output, err := cmd.Output()
if err != nil {
fmt.Println(err)
return
}
fmt.Println("Output: ", string(output))
}