Ian Lance Taylor | c5de72b | 2014-12-08 10:28:18 -0800 | [diff] [blame] | 1 | // +build !nacl |
| 2 | // run |
Russ Cox | cd22afa | 2012-09-23 13:16:14 -0400 | [diff] [blame] | 3 | |
Emmanuel Odeke | 53fd522 | 2016-04-10 14:32:26 -0700 | [diff] [blame] | 4 | // Copyright 2010 The Go Authors. All rights reserved. |
Russ Cox | a9a62ee | 2010-08-10 17:39:38 -0700 | [diff] [blame] | 5 | // Use of this source code is governed by a BSD-style |
| 6 | // license that can be found in the LICENSE file. |
| 7 | |
Ian Lance Taylor | c5de72b | 2014-12-08 10:28:18 -0800 | [diff] [blame] | 8 | package main |
| 9 | |
| 10 | import ( |
| 11 | "fmt" |
Ian Lance Taylor | c5de72b | 2014-12-08 10:28:18 -0800 | [diff] [blame] | 12 | "os" |
| 13 | "os/exec" |
| 14 | "path/filepath" |
Ian Lance Taylor | c5de72b | 2014-12-08 10:28:18 -0800 | [diff] [blame] | 15 | ) |
| 16 | |
| 17 | func main() { |
Russ Cox | 0f4132c | 2015-05-21 13:28:13 -0400 | [diff] [blame] | 18 | run("go", "tool", "compile", filepath.Join("fixedbugs", "bug302.dir", "p.go")) |
Russ Cox | cf932cd | 2015-05-21 13:28:17 -0400 | [diff] [blame] | 19 | run("go", "tool", "pack", "grc", "pp.a", "p.o") |
Russ Cox | 0f4132c | 2015-05-21 13:28:13 -0400 | [diff] [blame] | 20 | run("go", "tool", "compile", "-I", ".", filepath.Join("fixedbugs", "bug302.dir", "main.go")) |
Russ Cox | cf932cd | 2015-05-21 13:28:17 -0400 | [diff] [blame] | 21 | os.Remove("p.o") |
Ian Lance Taylor | c5de72b | 2014-12-08 10:28:18 -0800 | [diff] [blame] | 22 | os.Remove("pp.a") |
Russ Cox | cf932cd | 2015-05-21 13:28:17 -0400 | [diff] [blame] | 23 | os.Remove("main.o") |
Ian Lance Taylor | c5de72b | 2014-12-08 10:28:18 -0800 | [diff] [blame] | 24 | } |
| 25 | |
| 26 | func run(cmd string, args ...string) { |
| 27 | out, err := exec.Command(cmd, args...).CombinedOutput() |
| 28 | if err != nil { |
| 29 | fmt.Println(string(out)) |
| 30 | fmt.Println(err) |
| 31 | os.Exit(1) |
| 32 | } |
| 33 | } |