Skip to content

Commit 2afaef6

Browse files
authored
Fix setting rsync flags in case they are empty (#4044)
1 parent a87081f commit 2afaef6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

contrib/rsync.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,14 @@
237237
throw new \RuntimeException('You need to specify a destination path.');
238238
}
239239

240+
$rsyncFlags = (is_string($config['flags']) && trim($config['flags']) !== '') ? "-{$config['flags']}" : '';
241+
240242
$host = Context::get()->getHost();
241243
if ($host instanceof Localhost) {
242-
runLocally("rsync -{$config['flags']} {{rsync_options}}{{rsync_includes}}{{rsync_excludes}}{{rsync_filter}} '$src/' '$dst/'", $config);
244+
runLocally("rsync {$rsyncFlags} {{rsync_options}}{{rsync_includes}}{{rsync_excludes}}{{rsync_filter}} '$src/' '$dst/'", $config);
243245
return;
244246
}
245247

246248
$sshArguments = $host->connectionOptionsString();
247-
runLocally("rsync -{$config['flags']} -e 'ssh $sshArguments' {{rsync_options}}{{rsync_includes}}{{rsync_excludes}}{{rsync_filter}} '$src/' '{$host->connectionString()}:$dst/'", $config);
249+
runLocally("rsync {$rsyncFlags} -e 'ssh $sshArguments' {{rsync_options}}{{rsync_includes}}{{rsync_excludes}}{{rsync_filter}} '$src/' '{$host->connectionString()}:$dst/'", $config);
248250
});

0 commit comments

Comments
 (0)