forego icon indicating copy to clipboard operation
forego copied to clipboard

"forego start" exits immediately with doing nothing on macOS

Open ysmazda opened this issue 5 years ago • 2 comments

"forego start" exits immediately with doing nothing written in Procfile on macOS.

How to reproduce

GO111MODULE=off go get -u github.com/ddollar/forego
echo "echo: echo Hello" > Procfile.hello
forego start -f Procfile.hello
echo "touch: touch a.txt" > Procfile.touch
forego start -f Procfile.touch
ls a.txt

Expected behavior

Hello is output. a.txt is created.

$ forego start -f Procfile.hello
forego | starting echo.1 on port 5000
echo.1 | Hello
$ forego start -f Procfile.touch
forego  | starting touch.1 on port 5000
$ ls a.txt
a.txt

Actual behavior

Hello is not output. a.txt is not created.

$ forego start -f Procfile.hello
forego | starting echo.1 on port 5000
$ forego start -f Procfile.touch
forego  | starting touch.1 on port 5000
$ ls a.txt
ls: a.txt: No such file or directory

Platform info

$ go version
go version go1.13.4 darwin/amd64

$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.15
BuildVersion:   19A602

$ uname -rsv
Darwin 19.0.0 Darwin Kernel Version 19.0.0: Wed Sep 25 20:18:50 PDT 2019; root:xnu-6153.11.26~2/RELEASE_X86_64

$ sh --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin19)
Copyright (C) 2007 Free Software Foundation, Inc.

ysmazda avatar Dec 10 '19 21:12 ysmazda

This behavior was introduced by https://github.com/ddollar/forego/commit/51d9f6dc5ffb962e7efe4b461eca53d87587012c, and I got the expected behavior by using the source of https://github.com/ddollar/forego/commit/4bb213294ff63ed4fc2f095d57e425d9ca18a42b.

The cause of the behavior change seems to be the difference of source command between bash and sh where bash executes command after semicolon when the target file of source command does not exist but sh does not.

$ bash -c "source non-existent; echo hello"
bash: non-existent: No such file or directory
hello
$ sh -c "source non-existent; echo hello"
sh: non-existent: No such file or directory

ysmazda avatar Dec 10 '19 21:12 ysmazda

Same issue on alpine linux, solved for now by installing the last tagged version

go install github.com/ddollar/forego@20180216151118

padde avatar Aug 16 '22 08:08 padde