Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
55f8fd26
Commit
55f8fd26
authored
May 30, 2011
by
Andrew Gerrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gobuilder: remove some windows-specificity
R=alex.brainman CC=golang-dev
https://golang.org/cl/4528109
parent
3fbd478a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
13 deletions
+10
-13
misc/dashboard/builder/exec.go
misc/dashboard/builder/exec.go
+10
-13
No files found.
misc/dashboard/builder/exec.go
View file @
55f8fd26
...
...
@@ -10,7 +10,6 @@ import (
"io"
"log"
"os"
"runtime"
"strings"
)
...
...
@@ -19,10 +18,7 @@ func run(envv []string, dir string, argv ...string) os.Error {
if
*
verbose
{
log
.
Println
(
"run"
,
argv
)
}
if
runtime
.
GOOS
==
"windows"
&&
isBash
(
argv
[
0
])
{
// shell script cannot be executed directly on Windows.
argv
=
append
([]
string
{
"bash"
,
"-c"
},
argv
...
)
}
argv
=
useBash
(
argv
)
bin
,
err
:=
lookPath
(
argv
[
0
])
if
err
!=
nil
{
return
err
...
...
@@ -41,10 +37,7 @@ func runLog(envv []string, logfile, dir string, argv ...string) (output string,
if
*
verbose
{
log
.
Println
(
"runLog"
,
argv
)
}
if
runtime
.
GOOS
==
"windows"
&&
isBash
(
argv
[
0
])
{
// shell script cannot be executed directly on Windows.
argv
=
append
([]
string
{
"bash"
,
"-c"
},
argv
...
)
}
argv
=
useBash
(
argv
)
bin
,
err
:=
lookPath
(
argv
[
0
])
if
err
!=
nil
{
return
...
...
@@ -84,8 +77,12 @@ func lookPath(cmd string) (string, os.Error) {
return
exec
.
LookPath
(
cmd
)
}
// isBash determines if name refers to a shell script.
func
isBash
(
name
string
)
bool
{
// TODO(brainman): perhaps it is too simple and needs better check.
return
strings
.
HasSuffix
(
name
,
".bash"
)
// useBash prefixes a list of args with 'bash' if the first argument
// is a bash script.
func
useBash
(
argv
[]
string
)
[]
string
{
// TODO(brainman): choose a more reliable heuristic here.
if
strings
.
HasSuffix
(
argv
[
0
],
".bash"
)
{
argv
=
append
([]
string
{
"bash"
},
argv
...
)
}
return
argv
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment