From 80323eaab8a2a6d0340b85aaa8d61a1093a3130b Mon Sep 17 00:00:00 2001 From: NextTurn <45985406+NextTurn@users.noreply.github.com> Date: Sat, 25 Jul 2020 00:00:00 +0800 Subject: [PATCH] Disable undocumented argument concatenation --- src/WinSW/WrapperService.cs | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/src/WinSW/WrapperService.cs b/src/WinSW/WrapperService.cs index e66c2c7..60d61b6 100644 --- a/src/WinSW/WrapperService.cs +++ b/src/WinSW/WrapperService.cs @@ -273,21 +273,7 @@ namespace WinSW Log.Error(e); } - string? startArguments = this.descriptor.StartArguments; - - if (startArguments is null) - { - startArguments = this.descriptor.Arguments; - } - else - { - startArguments += " " + this.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*", " "); + string startArguments = this.descriptor.StartArguments ?? this.descriptor.Arguments; this.LogInfo("Starting " + this.descriptor.Executable); @@ -353,15 +339,12 @@ namespace WinSW { this.SignalPending(); - stopArguments += " " + this.descriptor.Arguments; - Process stopProcess = new Process(); - string? executable = this.descriptor.StopExecutable; - executable ??= this.descriptor.Executable; + string stopExecutable = this.descriptor.StopExecutable ?? this.descriptor.Executable; // TODO: Redirect logging to Log4Net once https://github.com/kohsuke/winsw/pull/213 is integrated - this.StartProcess(stopProcess, stopArguments, executable, null, false); + this.StartProcess(stopProcess, stopArguments, stopExecutable, null, false); Log.Debug("WaitForProcessToExit " + this.process.Id + "+" + stopProcess.Id); this.WaitForProcessToExit(this.process);