mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-10-31 08:03:43 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			23 lines
		
	
	
		
			409 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			409 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| // +build !windows,go1.6
 | |
| 
 | |
| package shellwords
 | |
| 
 | |
| import (
 | |
| 	"errors"
 | |
| 	"os"
 | |
| 	"os/exec"
 | |
| 	"strings"
 | |
| )
 | |
| 
 | |
| func shellRun(line string) (string, error) {
 | |
| 	shell := os.Getenv("SHELL")
 | |
| 	b, err := exec.Command(shell, "-c", line).Output()
 | |
| 	if err != nil {
 | |
| 		if eerr, ok := err.(*exec.ExitError); ok {
 | |
| 			b = eerr.Stderr
 | |
| 		}
 | |
| 		return "", errors.New(err.Error() + ":" + string(b))
 | |
| 	}
 | |
| 	return strings.TrimSpace(string(b)), nil
 | |
| }
 | 
