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

Fork into background even if stdout/err is redirected to a pipe #130

Closed
Germar opened this issue Jul 23, 2017 · 3 comments
Closed

Fork into background even if stdout/err is redirected to a pipe #130

Germar opened this issue Jul 23, 2017 · 3 comments
Labels

Comments

@Germar
Copy link

Germar commented Jul 23, 2017

With gocryptfs version 1.2 you could pipe stdout/err and it forked itself into background. With version 1.4 it does stay in foreground...

$ python3
Python 3.5.2 (default, Nov 17 2016, 17:05:23) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from subprocess import Popen, PIPE
>>> Popen(['./gocryptfs_1.2', '-version']).communicate()
gocryptfs v1.2; go-fuse 6c2b7d8; 2016-12-04 go1.7.4
(None, None)
>>> Popen(['./gocryptfs_1.2', '-extpass', 'echo foo', 'cipher', 'plain'], stdout = PIPE, stderr = PIPE).communicate()
(b'Reading password from extpass program\nDecrypting master key\nNot running on a terminal, suppressing master key display\nFilesystem mounted and ready.\n', b'')

Everything fine so far with 1.2. But if you do the same with 1.4:

>>> Popen(['fusermount', '-u', 'plain']).communicate()
(None, None)
>>> Popen(['./gocryptfs_1.4', '-version']).communicate()
gocryptfs v1.4 without_openssl; go-fuse v20170619; 2017-06-20 go1.8.3
(None, None)
>>> Popen(['./gocryptfs_1.4', '-extpass', 'echo foo', 'cipher', 'plain'], stdout = PIPE, stderr = PIPE).communicate()

Popen(...).communicate() will wait until you manually kill gocryptfs_1.4

Could you please add a '-bg' option in opposition to '-fg'?

EDIT:
gocryptfs version 1.3 was fine, too. The changes where made in 1.4

>>> Popen(['./gocryptfs_1.3', '-version']).communicate()
gocryptfs v1.3; go-fuse 5404bf0; 2017-04-29 go1.8
(None, None)
>>> Popen(['./gocryptfs_1.3', '-extpass', 'echo asdf', 'cipher', 'plain'], stdout = PIPE, stderr = PIPE).communicate()
(b'Reading password from extpass program\nDecrypting master key\nNot running on a terminal, suppressing master key display\nFilesystem mounted and ready.\n', b'')
>>> 
@rfjakob rfjakob added the bug label Jul 23, 2017
@rfjakob
Copy link
Owner

rfjakob commented Jul 23, 2017

Looks like logger that is used since 70c16fd keeps stdout open. Working on it.

rfjakob added a commit that referenced this issue Jul 23, 2017
rfjakob added a commit that referenced this issue Jul 23, 2017
We passed our stdout and stderr to the new logger instance,
which makes sense to see any error message, but also means that
the fd is kept open even when we close it.

Fixes the new TestMountBackground test and
#130 .
@rfjakob
Copy link
Owner

rfjakob commented Jul 23, 2017

Should be fixed in master by 496968e .

@Germar
Copy link
Author

Germar commented Jul 24, 2017

Works great 👍 Thanks for the quick fix

@Germar Germar closed this as completed Jul 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants