Skip to content

Commit d574f2b

Browse files
committed
fix: error when running xpostgres backup
1 parent 4b820a2 commit d574f2b

3 files changed

Lines changed: 23 additions & 23 deletions

File tree

clit/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
# -*- coding: utf-8 -*-
22
"""Main module for clit."""
3-
import os
43
import logging
4+
import os
55
from configparser import ConfigParser
66

77
from colorlog import ColoredFormatter
88

9-
109
__author__ = "W. Augusto Andreoli"
1110
__email__ = "andreoliwa@gmail.com"
1211

clit/db.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Database module."""
22
import argparse
33
from pathlib import Path
4+
from subprocess import PIPE
45
from typing import List, Optional
56

67
from clit.docker import DockerContainer
@@ -56,12 +57,12 @@ def __init__(self, *args, **kwargs):
5657
"""Determine which psql executable exists on this machine."""
5758
super().__init__(*args, **kwargs)
5859

59-
self.psql = shell("which psql", quiet=True, capture_output=True).stdout
60+
self.psql = shell("which psql", quiet=True, return_lines=True)[0]
6061
if not self.psql:
6162
self.psql = "psql_docker"
6263
self.inside_docker = True
6364

64-
self.pg_dump = shell("which pg_dump", quiet=True, capture_output=True).stdout
65+
self.pg_dump = shell("which pg_dump", quiet=True, return_lines=True)[0]
6566
if not self.pg_dump:
6667
self.pg_dump = "pg_dump_docker"
6768
self.inside_docker = True
@@ -77,7 +78,7 @@ def list_databases(self) -> "PostgreSQLServer":
7778
f"{self.psql} -c 'SELECT datname FROM pg_database WHERE datistemplate = false' "
7879
f"--tuples-only {self.docker_uri}",
7980
quiet=True,
80-
capture_output=True,
81+
stdout=PIPE,
8182
)
8283
if process.returncode:
8384
print(f"Error while listing databases.\nstdout={process.stdout}\nstderr={process.stderr}")

0 commit comments

Comments
 (0)