nickstenning / honcho

Honcho: a python clone of Foreman. For managing Procfile-based applications.
http://pypi.python.org/pypi/honcho
MIT License
1.59k stars 145 forks source link

Handle multiline strings in .env file #128

Closed joshfriend closed 9 years ago

joshfriend commented 9 years ago

see ddollar/foreman#250

Very useful for working with keys/certs loaded from environment variables.

nickstenning commented 9 years ago

Honcho has supported this since v0.5.0:

.env:

FOO="hello\nworld"

Procfile:

foo: echo $FOO

honcho output:

$ honcho start
23:59:49 system | foo.1 started (pid=74396)
23:59:49 foo.1  | hello
23:59:49 foo.1  | there
23:59:49 system | foo.1 stopped (rc=0)
joshfriend commented 9 years ago

@nickstenning I did some testing, and the multiline string handling does not correctly match that of Foreman:

test.procfile:

print: python -c "import os; print os.getenv('FOO')"

test.env:

FOO="hello\nworld"

Output from honcho==0.6.5:

$ honcho start print -f test.procfile -e test.env
10:19:51 system  | print.1 started (pid=15473)
10:19:51 print.1 | hello\nworld
10:19:51 system  | print.1 stopped (rc=0)

Ouptut from foreman:

$ foreman start print -f test.procfile -e test.env
10:30:59 print.1 | started with pid 17302
10:30:59 print.1 | hello
10:30:59 print.1 | world
10:30:59 print.1 | exited with code 0
10:30:59 system  | sending SIGTERM to all processes
SIGTERM received

I've re-opened #129 which should fix this.

nickstenning commented 9 years ago

Thanks for this. This is a regression in v0.6.5 introduced by the well-intentioned changes of 08063ea0dfead6850c243f5a2b5d917790252d6a. I'll look into it.

joshfriend commented 9 years ago

Thanks, I've updated the PR since there were conflicts.

nickstenning commented 9 years ago

Ugh. Python 3 removed the bytestring-to-bytestring decoders that I used to fix this in 920b0b0. Watch this space...

joshfriend commented 9 years ago

Life is too short. This will make the tests pass.

:laughing: