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

Added SH_WORD_SPLIT to fix zsh compatibility #318

Merged
merged 2 commits into from
May 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cmd/agent/workspace/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,8 @@ func InstallDocker(log log.Logger) error {
writer := log.Writer(logrus.InfoLevel, false)
defer writer.Close()

log.Debug("Installing Docker...")

shellCommand := exec.Command("sh", "-c", scripts.InstallDocker)
shellCommand.Stdout = writer
shellCommand.Stderr = writer
Expand Down
5 changes: 3 additions & 2 deletions cmd/context/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ func NewListCmd(flags *flags.GlobalFlags) *cobra.Command {
GlobalFlags: *flags,
}
listCmd := &cobra.Command{
Use: "list",
Short: "List DevPod contexts",
Use: "list",
Aliases: []string{"ls"},
Short: "List DevPod contexts",
RunE: func(_ *cobra.Command, args []string) error {
return cmd.Run(context.Background())
},
Expand Down
5 changes: 3 additions & 2 deletions cmd/ide/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ func NewListCmd(flags *flags.GlobalFlags) *cobra.Command {
GlobalFlags: *flags,
}
listCmd := &cobra.Command{
Use: "list",
Short: "List available IDEs",
Use: "list",
Aliases: []string{"ls"},
Short: "List available IDEs",
RunE: func(_ *cobra.Command, args []string) error {
return cmd.Run(context.Background())
},
Expand Down
5 changes: 3 additions & 2 deletions cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ func NewListCmd(flags *flags.GlobalFlags) *cobra.Command {
GlobalFlags: flags,
}
listCmd := &cobra.Command{
Use: "list",
Short: "Lists existing workspaces",
Use: "list",
Aliases: []string{"ls"},
Short: "Lists existing workspaces",
RunE: func(_ *cobra.Command, args []string) error {
if len(args) > 0 {
return fmt.Errorf("no arguments are allowed for this command")
Expand Down
5 changes: 3 additions & 2 deletions cmd/machine/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ func NewListCmd(flags *flags.GlobalFlags) *cobra.Command {
GlobalFlags: flags,
}
listCmd := &cobra.Command{
Use: "list",
Short: "Lists existing machines",
Use: "list",
Aliases: []string{"ls"},
Short: "Lists existing machines",
RunE: func(_ *cobra.Command, args []string) error {
return cmd.Run(context.Background())
},
Expand Down
7 changes: 4 additions & 3 deletions cmd/provider/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ func NewListCmd(flags *flags.GlobalFlags) *cobra.Command {
GlobalFlags: *flags,
}
listCmd := &cobra.Command{
Use: "list",
Short: "List available providers",
Args: cobra.NoArgs,
Use: "list",
Aliases: []string{"ls"},
Short: "List available providers",
Args: cobra.NoArgs,
RunE: func(_ *cobra.Command, args []string) error {
return cmd.Run(context.Background())
},
Expand Down
1 change: 1 addition & 0 deletions pkg/inject/inject.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func InjectAndExecute(
if err != nil {
return true, err
}

log.Debugf("execute inject script")
defer log.Debugf("done injecting")

Expand Down
12 changes: 8 additions & 4 deletions pkg/inject/inject.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!/bin/sh
set -e

if [ "$SHELL" != "${SHELL%"/zsh"*}" ]; then
setopt SH_WORD_SPLIT
fi

INSTALL_DIR="{{ .InstallDir }}"
INSTALL_FILENAME="{{ .InstallFilename }}"

Expand Down Expand Up @@ -51,19 +55,19 @@ download() {
fi

while :; do
status=""
cmd_status=""
if command_exists curl; then
$sh_c "curl -fsSL $DOWNLOAD_URL -o $INSTALL_PATH" && break
status=$?
cmd_status=$?
elif command_exists wget; then
$sh_c "wget -q $DOWNLOAD_URL -O $INSTALL_PATH" && break
status=$?
cmd_status=$?
else
echo "error: no download tool found, please install curl or wget"
exit 127
fi
>&2 echo "error: failed to download devpod"
>&2 echo " command returned: ${status}"
>&2 echo " command returned: ${cmd_status}"
>&2 echo "Trying again in 10 seconds..."
sleep 10
done
Expand Down