@@ -347,7 +347,7 @@ def read_binary(self, filename, start_pos):
347347assert type (start_pos )== int # noqa: E721
348348assert start_pos >= 0
349349
350- cmd = "tail -c +{} {} " .format (start_pos + 1 , __class__ . _escape_path ( filename ))
350+ cmd = [ "tail" , "-c" , " +{}" .format (start_pos + 1 ), filename ]
351351r = self .exec_command (cmd )
352352assert type (r )== bytes # noqa: E721
353353return r
@@ -367,7 +367,7 @@ def get_file_size(self, filename):
367367
368368assert filename is not None
369369assert type (filename )== str # noqa: E721
370- cmd = "du -b " + __class__ . _escape_path ( filename )
370+ cmd = [ "du" , "-b" , filename ]
371371
372372s = self .exec_command (cmd ,encoding = get_default_encoding ())
373373assert type (s )== str # noqa: E721
@@ -462,15 +462,6 @@ def db_connect(self, dbname, user, password=None, host="localhost", port=5432):
462462 )
463463return conn
464464
465- def _escape_path (path ):
466- assert type (path )== str # noqa: E721
467- assert path != "" # Ok?
468-
469- r = "'"
470- r += path
471- r += "'"
472- return r
473-
474465
475466def normalize_error (error ):
476467if isinstance (error ,bytes ):