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

start_options are not passed on correctly #9

Closed
fentas opened this issue Nov 12, 2017 · 1 comment
Closed

start_options are not passed on correctly #9

fentas opened this issue Nov 12, 2017 · 1 comment

Comments

@fentas
Copy link

fentas commented Nov 12, 2017

Summary

It seems that start_options does not preserve argument strings and splits everything.

Test Case

wbs.toml:

# [...]
start_options = ["/bin/sh", "-c", "echo foobar"]

main.go

package main

import (
	"fmt"
	"os"
)

func main() {
	fmt.Println("third argument:", os.Args[3])
}

Results in echo

What I would expect

That the given example should output echo foobar not only echo.

Workaround

Wrapping the third argument again in single qutes result in the wanted output.

start_options = ["/bin/sh", "-c", "'echo foobar'"]
@achiku
Copy link
Owner

achiku commented Feb 14, 2018

@fentas Sorry for being late reply, but that's how os.Args works, and nothing to do with wbs.

$ ./bin/argprint 1 2 3 4
third argument: 3
package main

import (
	"fmt"
	"os"
)

func main() {
	fmt.Println("third argument:", os.Args[3])
}
root_path = "."

watch_target_dirs = ["."]
watch_exclude_dirs = [".git", "vendor", "bin"]
watch_file_ext = [".go", ".tmpl", ".html"]
# usually used when we need to ignore files generated by `go generate`
# need to include dir path
watch_file_exclude_pattern = [
    "lib/*_gen.go",
    "lib/bindata.go"
]

build_target_dir = "bin"
build_target_name = "argprint"
build_command = "go"
build_options = ["build", "-v"]

# command will be  `build_target_dir/build_target_name start_options`
# in this case bin/myserver -v
# start_options = ["-v"]
start_options = ["/bin/sh", "-c", "echo foobar"]

# default true, but it's possible to make this fale, when
# running a program that doesn't persist as a process
restart_process = false

@achiku achiku closed this as completed Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants