Created
October 30, 2021 18:27
-
-
Save codephilosopher/920525ad7a0e26a1608479d4a6df33bd to your computer and use it in GitHub Desktop.
go exec.Command
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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