Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
a780dd78
Unverified
Commit
a780dd78
authored
Jan 30, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Jan 30, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #73469 from dany74q/patch-1
Added windows executable extensions to Kubectl plugins
parents
f2ade8e9
aae1944a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
13 deletions
+5
-13
cmd.go
pkg/kubectl/cmd/cmd.go
+0
-7
plugin.go
pkg/kubectl/cmd/plugin/plugin.go
+5
-6
No files found.
pkg/kubectl/cmd/cmd.go
View file @
a780dd78
...
@@ -22,7 +22,6 @@ import (
...
@@ -22,7 +22,6 @@ import (
"io"
"io"
"os"
"os"
"os/exec"
"os/exec"
"runtime"
"strings"
"strings"
"syscall"
"syscall"
...
@@ -339,12 +338,6 @@ type defaultPluginHandler struct{}
...
@@ -339,12 +338,6 @@ type defaultPluginHandler struct{}
// Lookup implements PluginHandler
// Lookup implements PluginHandler
func
(
h
*
defaultPluginHandler
)
Lookup
(
filename
string
)
(
string
,
error
)
{
func
(
h
*
defaultPluginHandler
)
Lookup
(
filename
string
)
(
string
,
error
)
{
// if on Windows, append the "exe" extension
// to the filename that we are looking up.
if
runtime
.
GOOS
==
"windows"
{
filename
=
filename
+
".exe"
}
return
exec
.
LookPath
(
filename
)
return
exec
.
LookPath
(
filename
)
}
}
...
...
pkg/kubectl/cmd/plugin/plugin.go
View file @
a780dd78
...
@@ -100,11 +100,7 @@ func (o *PluginListOptions) Complete(cmd *cobra.Command) error {
...
@@ -100,11 +100,7 @@ func (o *PluginListOptions) Complete(cmd *cobra.Command) error {
seenPlugins
:
make
(
map
[
string
]
string
,
0
),
seenPlugins
:
make
(
map
[
string
]
string
,
0
),
}
}
path
:=
"PATH"
o
.
PluginPaths
=
filepath
.
SplitList
(
os
.
Getenv
(
"PATH"
))
if
runtime
.
GOOS
==
"windows"
{
path
=
"path"
}
o
.
PluginPaths
=
filepath
.
SplitList
(
os
.
Getenv
(
path
))
return
nil
return
nil
}
}
...
@@ -230,7 +226,10 @@ func isExecutable(fullPath string) (bool, error) {
...
@@ -230,7 +226,10 @@ func isExecutable(fullPath string) (bool, error) {
}
}
if
runtime
.
GOOS
==
"windows"
{
if
runtime
.
GOOS
==
"windows"
{
if
strings
.
HasSuffix
(
info
.
Name
(),
".exe"
)
{
fileExt
:=
strings
.
ToLower
(
filepath
.
Ext
(
fullPath
))
switch
fileExt
{
case
".bat"
,
".cmd"
,
".com"
,
".exe"
:
return
true
,
nil
return
true
,
nil
}
}
return
false
,
nil
return
false
,
nil
...
...
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