Skip to content

Instantly share code, notes, and snippets.

@codephilosopher
Created October 30, 2021 18:27
Show Gist options
  • Save codephilosopher/920525ad7a0e26a1608479d4a6df33bd to your computer and use it in GitHub Desktop.
Save codephilosopher/920525ad7a0e26a1608479d4a6df33bd to your computer and use it in GitHub Desktop.
go exec.Command
package main
import (
"log"
"os"
"os/exec"
)
func main() {
cmd1 := exec.Command("gcc", "-o", "sample", "golang/experiment/sample.c")
cmd1.Stdout = os.Stdout
cmd1.Stderr = os.Stderr
err := cmd1.Run()
if err != nil {
log.Fatalf("cmd.Run() failed with %s\n", err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment