Last active
August 29, 2015 14:18
-
-
Save thomasdegry/e22e2275d96762182e56 to your computer and use it in GitHub Desktop.
Exit code
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 ( | |
"fmt" | |
"log" | |
"os/exec" | |
) | |
func main() { | |
takePhoto() | |
} | |
func takePhoto() { | |
cmd := exec.Command("./photo.sh") | |
output, err := cmd.Output() | |
if _, ok := err.(*exec.ExitError); ok { | |
log.Println("command ran but exit status wasn't 0", err) | |
exec.Command("./kill-camera.sh") | |
return | |
} | |
fmt.Println(output) | |
return | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment