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

Allow running as console application on Windows #2754

Merged
merged 4 commits into from
Jan 25, 2018
Merged
Changes from 1 commit
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
Next Next commit
allow windows service to be run as console application
  • Loading branch information
MondayHopscotch committed May 2, 2017
commit 4f79fcb93bb82ee0b7e641ed1b37aed5e5edeee6
3 changes: 2 additions & 1 deletion cmd/telegraf/telegraf.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ var fUsage = flag.String("usage", "",
"print usage for a plugin, ie, 'telegraf -usage mysql'")
var fService = flag.String("service", "",
"operate on the service")
var fRunAsConsole = flag.Bool("run-as-console", false, "run as console application (windows only)")

// Telegraf version, populated linker.
// ie, -ldflags "-X main.version=`git describe --always --tags`"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps the usage string should be updated to contain the new console flag?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah just rename the flag and we can merge.

Expand Down Expand Up @@ -342,7 +343,7 @@ func main() {
return
}

if runtime.GOOS == "windows" {
if runtime.GOOS == "windows" && !(*fRunAsConsole) {
svcConfig := &service.Config{
Name: "telegraf",
DisplayName: "Telegraf Data Collector Service",
Expand Down