Feature/eliminate newlines (#483)

* Added code to collapse newlines, line returns and groups of spaces into a single space.
This is to allow users to put lots of arguments into the configuration xml using one
line per argument for readability.  This is really helpful when trying to wrap swarm-client.jar
calls which can have a lot of long arguments.

* fixed the comment text.

* included tabs in the list of things to collapse.

* added back in the missing space for the tab.

* Switched to a regex.

* Just removing newlines, line returns and tabs.

* Trimming off leading and trailing whitespace.

* Updated per recommendation from NextTurn.
pull/486/head
Scott Selberg 2020-04-06 18:36:03 -06:00 committed by GitHub
parent 691b4d2945
commit fef46672ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -8,6 +8,7 @@ using System.Runtime.InteropServices;
using System.Security.AccessControl;
using System.ServiceProcess;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
#if VNEXT
using System.Threading.Tasks;
@ -276,6 +277,11 @@ namespace winsw
startarguments += " " + _descriptor.Arguments;
}
// Converting newlines, line returns, tabs into a single
// space. This allows users to provide multi-line arguments
// in the xml for readability.
startarguments = Regex.Replace(startarguments, @"\s*[\n\r]+\s*", " ");
LogEvent("Starting " + _descriptor.Executable + ' ' + startarguments);
Log.Info("Starting " + _descriptor.Executable + ' ' + startarguments);