diff --git a/bin/plugin/commands/release.js b/bin/plugin/commands/release.js index 56a232d13882c..16f8f8796e903 100644 --- a/bin/plugin/commands/release.js +++ b/bin/plugin/commands/release.js @@ -6,6 +6,7 @@ const fs = require( 'fs' ); const semver = require( 'semver' ); const Octokit = require( '@octokit/rest' ); const { sprintf } = require( 'sprintf-js' ); +const os = require( 'os' ); /** * Internal dependencies @@ -518,13 +519,27 @@ async function runUpdateTrunkContentStep( newReadmeFileContent.replace( STABLE_TAG_PLACEHOLDER, stableTag ) ); + let xargsOpts = ''; + if ( os.platform === 'linux' ) { + // When xargs receives no arguments, it behaves differently in macOS and linux: + // - macOS: doesn't run + // - linux: run without arguments + // + // In linux, the -r option teaches xargs not to run if it receives no arguments. + xargsOpts = '-r'; + } + // Commit the content changes runShellScript( - "svn st | grep '^?' | awk '{print $2}' | xargs svn add", + "svn st | grep '^?' | awk '{print $2}' | xargs " + + xargsOpts + + ' svn add', svnWorkingDirectoryPath ); runShellScript( - "svn st | grep '^!' | awk '{print $2}' | xargs svn rm", + "svn st | grep '^!' | awk '{print $2}' | xargs " + + xargsOpts + + ' svn rm', svnWorkingDirectoryPath ); await askForConfirmation( diff --git a/docs/contributors/release.md b/docs/contributors/release.md index 97bf6d2acb23e..a1bc58edce80a 100644 --- a/docs/contributors/release.md +++ b/docs/contributors/release.md @@ -199,9 +199,9 @@ You'll need to use Subversion to publish the plugin to WordPress.org. 6. Add new files/remove deleted files from the repository: ```bash # Add new files: -svn st | grep '^\?' | awk '{print $2}' | xargs svn add +svn st | grep '^\?' | awk '{print $2}' | xargs svn add # add the -r option to xargs if you use a linux-based OS # Delete old files: -svn st | grep '^!' | awk '{print $2}' | xargs svn rm +svn st | grep '^!' | awk '{print $2}' | xargs svn rm # add the -r option to xargs if you use a linux-based OS ``` 7. Commit the new version: ```bash