def main(): ''' Entry point of autostack. ''' create_pipe(PIPE_PATH) with open(PIPE_PATH) as pipe: listen_for_errors(pipe)
def capture(): ''' Capture all error messages outputed in the terminal for configured languages. ''' create_pipe(PIPE_PATH) if sys.platform.startswith('darwin'): # Mac subprocess.run(['script', '-q', '-F', '/tmp/monitorPipe'], check=True) else: subprocess.run(['script', '-q', '-f', '/tmp/monitorPipe'], check=True)
def test_create_pipe_file_doesnt_exist(): '''' Ensures that create_pipe creates a pipe, if it doesn't exist. ''' # 1. Given. path = '/tmp/pipe' # 2. When. create_pipe(path) # 3. Then. assert os.path.exists(path) os.remove(path)
def test_create_pipe_file_already_exists(): '''' Ensures that if a file already exists at the specifies path, it will not be overwritten. ''' # 1. Given. path = '/tmp/pipe' # 2. When. os.mkfifo(path) mtime = os.path.getmtime(path) create_pipe(path) # 3. Then. assert os.path.getmtime(path) == mtime
def test_create_pipe_dir_doesnt_exist(): '''' Ensures that create_pipe creates the directories to the pipe recursively. ''' # 1. Given. path = '/tmp/test/dir/pipe' # 2. When. create_pipe(path) # 3. Then. assert os.path.exists(path) shutil.rmtree('/tmp/test/')