Skip to content

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

Closed
@Germar

Description

@Germar

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'')
>>> 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions