File rdiff-backup-fix-deprecations.diff of Package rdiff-backup

Index: b/rdiff_backup/SetConnections.py
===================================================================
--- a/rdiff_backup/SetConnections.py
+++ b/rdiff_backup/SetConnections.py
@@ -25,7 +25,7 @@ the related connections.
 
 """
 
-import os, sys
+import os, sys, shlex, subprocess
 from log import Log
 import Globals, connection, rpath
 
@@ -135,17 +135,15 @@ def init_connection(remote_cmd):
 	if not remote_cmd: return Globals.local_connection
 
 	Log("Executing " + remote_cmd, 4)
-	if os.name == "nt":
-		import subprocess
-		try:
-			process = subprocess.Popen(remote_cmd, shell=False, bufsize=0,
-								stdin=subprocess.PIPE, 
-								stdout=subprocess.PIPE)
-			(stdin, stdout) = (process.stdin, process.stdout)
-		except OSError:
-			(stdin, stdout) = (None, None)
-	else:
-		stdin, stdout = os.popen2(remote_cmd)
+        args = shlex.split(remote_cmd)
+        try:
+                process = subprocess.Popen(args, shell=False, bufsize=-1,
+                                           stdin=subprocess.PIPE,
+                                           stdout=subprocess.PIPE,
+                                           close_fds=True)
+                (stdin, stdout) = (process.stdin, process.stdout)
+        except OSError:
+                (stdin, stdout) = (None, None)
 	conn_number = len(Globals.connections)
 	conn = connection.PipeConnection(stdout, stdin, conn_number)