Created
October 25, 2014 19:11
-
-
Save mlbright/870f4765d5355a91441f to your computer and use it in GitHub Desktop.
shell script-ish example
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 ( | |
"io/ioutil" | |
"log" | |
"os" | |
"os/exec" | |
) | |
const compile_script = "run.sh" | |
func main() { | |
err := os.Chdir(os.Getenv("WORKSPACE")) | |
if err != nil { | |
log.Fatal(err) | |
} | |
if os.Getenv("COMPILE") == "Y" { | |
log.Println("*** Compiling") | |
err := ioutil.WriteFile(compile_script, []byte(compile), 0644) | |
if err != nil { | |
log.Fatal(err) | |
} | |
cmd := exec.Command("bash", "-e", compile_script) | |
cmd.Stdout = os.Stdout | |
cmd.Stderr = os.Stderr | |
err = cmd.Run() | |
if err != nil { | |
log.Fatal(err) | |
} | |
log.Println("*** Finished compiling") | |
} | |
} | |
const compile = ` | |
#!/bin/bash | |
export TOP=$WORKSPACE/src/studio | |
export BUILD=$WORKSPACE/build | |
export VARIANT=Release | |
mkdir -p $BUILD | |
cd $BUILD | |
echo something > Jamfile.jam | |
echo something else >> Jamfile.jam | |
gcc --version | |
` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment