Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Difficult to Exit buffalo dev Command Line on Windows #750

Closed
turnkey-commerce opened this issue Nov 12, 2017 · 10 comments
Closed

Difficult to Exit buffalo dev Command Line on Windows #750

turnkey-commerce opened this issue Nov 12, 2017 · 10 comments
Labels
bug Something isn't working os-specific This issue is OS-specific

Comments

@turnkey-commerce
Copy link

When using Ctl-C on the command line to exit a buffalo dev session the cmd tool remains locked and unable to enter other commands.

A typical interaction:

<user enters Ctl-c>
Shutting down application
Shutting down worker
http: Server closed

C:\Users\James\go\src\github.com\turnkey-commerce\coke>^CTerminate batch job (Y/N)? <user enters Y>
'Y' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\James\go\src\github.com\turnkey-commerce\coke><user enters return>
Terminate batch job (Y/N)? C:\Users\James\go\src\github.com\turnkey-commerce\coke>

A workaround is to enter Y followed by two returns and the command prompt will usually come back.

@markbates markbates added bug Something isn't working os-specific This issue is OS-specific labels Nov 13, 2017
@markbates
Copy link
Member

Can you please run buffalo info inside your application and paste in the results? Thanks.

@turnkey-commerce
Copy link
Author

No problem, here is what I get, started happening when I upgraded to 0.10.1:

λ buffalo info

Buffalo Version

v0.10.1

Go Version

go version go1.9.2 windows/amd64

Go Env

set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\James\go
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\James\AppData\Local\Temp\go-build278057119=/tmp/go-build -gno-record-gcc-switches
set CXX=g++
set CGO_ENABLED=1
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config

Node Version

v8.9.0

NPM Version

5.5.1

Dep Status

could not find project Gopkg.toml, use dep init to initiate a manifest

PostgreSQL Version

PostgreSQL Not Found

MySQL Version

MySQL Not Found

SQLite Version

SQLite Not Found

@turnkey-commerce
Copy link
Author

I observed that the following method to launch will work with Windows to suppress the need for input when exiting:

buffalo dev < nul

Perhaps it would be possible to similarly redirect programatically when executing the dev command from Windows.

@ntakouris
Copy link
Contributor

ntakouris commented Jan 11, 2018

λ buffalo info

Did you run the commands on a different command line than the standard Command Prompt or Powershell? (Asking due to the λ infront)

@turnkey-commerce
Copy link
Author

I ran it on a cmder shell but I noticed it happens in other shell environments as well and a standard Windows cmd prompt.

It's a nice shell tool for Windows and is a terminal emulator for other cmd environments including Powershell.

http://cmder.net/

@gintsgints
Copy link

Sorry for offtopic. I use https://conemu.github.io/ for shell wrap & bash shell to execute.
On topic - same problem for me.

@gintsgints
Copy link

gintsgints commented Feb 23, 2018

On bash (started from Visual Studio Code) I get

html db=0s duration=14.994ms human_size="7.3 kB" method=GET params="{}" path=/ render=8.0008ms request_id=7632e81ffc-1a75624f72 size=7281 status=200
^CTerminate batch job (Y/N)?

gpolis@DT00344 MINGW64 ~/Documents/golang/src/gitlab.com/gintsgints/coke (master)
$
Terminate batch job (Y/N)? ^C
gpolis@DT00344 MINGW64 ~/Documents/golang/src/gitlab.com/gintsgints/coke (master)
$ ^C
gpolis@DT00344 MINGW64 ~/Documents/golang/src/gitlab.com/gintsgints/coke (master)
$ ^C^C

That is only Ctrl+C gives some output... and no other keys

@gintsgints
Copy link

In pure CMD I somehow manage to get out of that:

       [9] ./~/font-awesome/fonts/fontawesome-webfont.svg?v=4.7.0 82 bytes {0} [built]

C:\Users\gpolis\Documents\golang\src\gitlab.com\gintsgints\coke>^CTerminate batch job (Y/N)? Y
'Y' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\gpolis\Documents\golang\src\gitlab.com\gintsgints\coke>dir


^C:\Users\gpolis\Documents\golang\src\gitlab.com\gintsgints\coke>CTerminate batch job (Y/N)?

^C:\Users\gpolis\Documents\golang\src\gitlab.com\gintsgints\coke>C
^C

C:\Users\gpolis\Documents\golang\src\gitlab.com\gintsgints\coke>dir
 Volume in drive C has no label.
 Volume Serial Number is D0BF-AD72

@UnQuaiz
Copy link

UnQuaiz commented Jun 28, 2018

Same problem. After CTRL+C pressed, and "Terminate batch job" appeared - if i type some thing except "Y", terminal hangs and not respond at all.
in FarManager command line + Windows 10

After investigating this issue i came up that this is node.js or Webpack bug.
Maybe dev.go : startWebpack - should be rewritten to handle signals and gracefully close proccesses.
or even webpack.config.js

this, partially, solved issue for me:

buffalo\buffalo\cmd\dev.go

func setupCloseHandler(cmd *exec.Cmd) {
	c := make(chan os.Signal, 2)
	signal.Notify(c, os.Interrupt, syscall.SIGTERM)
	go func() {
		<-c
		if cmd.Process != nil {
                        //kill proccess and exit
			cmd.Process.Kill()
			os.Exit(2)
			return
		}
	}()
}

func startWebpack(ctx context.Context) error {
        ....

	cmd := exec.CommandContext(ctx, webpack.BinPath, "--watch")
	cmd.Stdin = os.Stdin
	cmd.Stderr = os.Stderr
	cmd.Stdout = os.Stdout

	setupCloseHandler(cmd)

	return cmd.Run()
}

I mean partially - is that buffallo exits, there is no "Terminate batch job" message, terminal runs normally, BUT, in 2-5 seconds some output from webpack is apperead in terminal.

Maybe there is more elegant way to solve this issue. Im just started learning golang and maybe im going wrong way

@vitr
Copy link

vitr commented Sep 24, 2018

I'm on Windows 10, same issue, but I use cmder with git-bash, so, this solved the issue for me
buffalo dev < /dev/null

markbates added a commit that referenced this issue Oct 3, 2018
markbates added a commit that referenced this issue Oct 3, 2018
* Update Bootstrap version

https://nvd.nist.gov/vuln/detail/CVE-2018-14041

* update Dockerfile and Makefile; removed go.*

* updated to use release

* version bump: v0.12.7-rc.1

* generated goreleaser

* version bump: v0.12.7-beta.1

* fixed releaser template

* generated goreleaser

* fixed broken deps

* fixed a few lint issues

* clean up packr files before gometalinter sees them

* fixes CloseNotify lint issue

* touch router_test

* use the development image

* fixes appveyor

* compile in sqlite

* removed stderr from plugin check

* updated deps

* removed Gopkg.toml

* fixes #750

* package logo.svg into binary
stanislas-m added a commit that referenced this issue Oct 4, 2018
* V0.12.7 (#1349)

* Update Bootstrap version

https://nvd.nist.gov/vuln/detail/CVE-2018-14041

* update Dockerfile and Makefile; removed go.*

* updated to use release

* version bump: v0.12.7-rc.1

* generated goreleaser

* version bump: v0.12.7-beta.1

* fixed releaser template

* generated goreleaser

* fixed broken deps

* fixed a few lint issues

* clean up packr files before gometalinter sees them

* fixes CloseNotify lint issue

* touch router_test

* use the development image

* fixes appveyor

* compile in sqlite

* removed stderr from plugin check

* updated deps

* removed Gopkg.toml

* fixes #750

* package logo.svg into binary

* version bump: v0.12.7

* generated goreleaser

* fixed tap

* generated goreleaser
markbates pushed a commit that referenced this issue Oct 8, 2018
* V0.12.7 (#1349)

* Update Bootstrap version

https://nvd.nist.gov/vuln/detail/CVE-2018-14041

* update Dockerfile and Makefile; removed go.*

* updated to use release

* version bump: v0.12.7-rc.1

* generated goreleaser

* version bump: v0.12.7-beta.1

* fixed releaser template

* generated goreleaser

* fixed broken deps

* fixed a few lint issues

* clean up packr files before gometalinter sees them

* fixes CloseNotify lint issue

* touch router_test

* use the development image

* fixes appveyor

* compile in sqlite

* removed stderr from plugin check

* updated deps

* removed Gopkg.toml

* fixes #750

* package logo.svg into binary

* version bump: v0.12.7

* generated goreleaser

* fixed tap

* generated goreleaser

* fixes broken Dockerfile.build on master

* extracting module from go.mod

* removing start and end from regexp to capture the module name

* modifying comment

* fixing go.mod

* fixing dockerfgile

* vadding version.go changes

* fixing merges pending

* fixing missing conflicts

* adding tests for the modules package name

* adding other 2 tests

* adding testss for empty go.mod
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working os-specific This issue is OS-specific
Projects
None yet
Development

No branches or pull requests

6 participants