2018-03-04 04:15:37 -07:00
|
|
|
// +build !nacl,!js
|
2014-12-08 11:28:18 -07:00
|
|
|
// run
|
2012-09-23 11:16:14 -06:00
|
|
|
|
2016-04-10 15:32:26 -06:00
|
|
|
// Copyright 2010 The Go Authors. All rights reserved.
|
2010-08-10 18:39:38 -06:00
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2014-12-08 11:28:18 -07:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2019-11-18 06:58:58 -07:00
|
|
|
"io/ioutil"
|
2014-12-08 11:28:18 -07:00
|
|
|
"os"
|
|
|
|
"os/exec"
|
|
|
|
"path/filepath"
|
|
|
|
)
|
|
|
|
|
2019-11-18 06:58:58 -07:00
|
|
|
var tmpDir string
|
|
|
|
|
2014-12-08 11:28:18 -07:00
|
|
|
func main() {
|
2019-11-18 06:58:58 -07:00
|
|
|
fb, err := filepath.Abs("fixedbugs")
|
|
|
|
if err == nil {
|
|
|
|
tmpDir, err = ioutil.TempDir("", "bug302")
|
|
|
|
}
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println(err)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
defer os.RemoveAll(tmpDir)
|
|
|
|
|
|
|
|
run("go", "tool", "compile", filepath.Join(fb, "bug302.dir", "p.go"))
|
2015-05-21 11:28:17 -06:00
|
|
|
run("go", "tool", "pack", "grc", "pp.a", "p.o")
|
2019-11-18 06:58:58 -07:00
|
|
|
run("go", "tool", "compile", "-I", ".", filepath.Join(fb, "bug302.dir", "main.go"))
|
2014-12-08 11:28:18 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func run(cmd string, args ...string) {
|
2019-11-18 06:58:58 -07:00
|
|
|
c := exec.Command(cmd, args...)
|
|
|
|
c.Dir = tmpDir
|
|
|
|
out, err := c.CombinedOutput()
|
2014-12-08 11:28:18 -07:00
|
|
|
if err != nil {
|
|
|
|
fmt.Println(string(out))
|
|
|
|
fmt.Println(err)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|