2019-05-04 19:06:00 +00:00
|
|
|
from os import mkfifo, remove, chmod
|
2018-12-16 20:22:20 +00:00
|
|
|
from os.path import exists
|
|
|
|
|
2019-07-29 16:15:19 +00:00
|
|
|
DEFAULT_PERMISSIONS = 0o600
|
|
|
|
|
2018-12-16 20:22:20 +00:00
|
|
|
|
|
|
|
class Pipe:
|
|
|
|
def __init__(self, path):
|
|
|
|
self.path = path
|
|
|
|
|
2019-05-04 19:06:00 +00:00
|
|
|
def recreate(self, permissions):
|
2018-12-16 20:22:20 +00:00
|
|
|
self.remove()
|
2019-05-04 19:06:00 +00:00
|
|
|
mkfifo(self.path)
|
2019-05-04 20:49:45 +00:00
|
|
|
chmod(self.path, permissions) # use chmod to ignore umask
|
2018-12-16 20:22:20 +00:00
|
|
|
|
|
|
|
def remove(self):
|
|
|
|
if exists(self.path):
|
|
|
|
remove(self.path)
|