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
|
|
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
chmod(self.path, permissions)
|
2018-12-16 20:22:20 +00:00
|
|
|
|
|
|
|
def remove(self):
|
|
|
|
if exists(self.path):
|
|
|
|
remove(self.path)
|