mirror of
				https://github.com/gravitl/netmaker.git
				synced 2025-10-31 04:06:37 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			33 lines
		
	
	
		
			724 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			724 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package ncutils
 | |
| 
 | |
| import (
 | |
| 	"fmt"
 | |
| 	"os/exec"
 | |
| 	"strings"
 | |
| 
 | |
| 	"github.com/gravitl/netmaker/logger"
 | |
| )
 | |
| 
 | |
| // RunCmd - runs a local command
 | |
| func RunCmd(command string, printerr bool) (string, error) {
 | |
| 	args := strings.Fields(command)
 | |
| 	cmd := exec.Command(args[0], args[1:]...)
 | |
| 	cmd.Wait()
 | |
| 	out, err := cmd.CombinedOutput()
 | |
| 	if err != nil && printerr {
 | |
| 		logger.Log(0, fmt.Sprintf("error running command: %s", command))
 | |
| 		logger.Log(0, strings.TrimSuffix(string(out), "\n"))
 | |
| 	}
 | |
| 	return string(out), err
 | |
| }
 | |
| 
 | |
| // RunCmdFormatted - does nothing for linux
 | |
| func RunCmdFormatted(command string, printerr bool) (string, error) {
 | |
| 	return "", nil
 | |
| }
 | |
| 
 | |
| // GetEmbedded - if files required for linux, put here
 | |
| func GetEmbedded() error {
 | |
| 	return nil
 | |
| }
 | 
