Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: add $HOSTTYPE and $OSTYPE #912

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions interp/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"math/rand"
"os"
"path/filepath"
"runtime"
"strconv"
"sync"
"time"
Expand Down Expand Up @@ -617,10 +618,23 @@ func (r *Runner) Reset() {
r.setVarString("IFS", " \t\n")
r.setVarString("OPTIND", "1")

r.setVarString("HOSTTYPE", goos2hosttype[runtime.GOOS])
r.setVarString("OSTYPE", goarch2ostype[runtime.GOARCH])

r.dirStack = append(r.dirStack, r.Dir)
r.didReset = true
}

// FIXME: add more goarch and goos
var goos2hosttype = map[string]string{
"linux": "linux-gnu",
"darwin": "darwin17.7.0",
}
var goarch2ostype = map[string]string{
"386": "i686",
"amd64": "x86_64",
}

// exitStatus is a non-zero status code resulting from running a shell node.
type exitStatus uint8

Expand Down