@@ -99,6 +99,9 @@ let main argv =
9999 let result = parser.Parse argv
100100 let subCommand = result.GetSubCommand()
101101
102+ let pattern = @" (\d+\.\d+\.\d+\.\d+[\w\d-]*)"
103+ let regexOptions = RegexOptions.Singleline
104+
102105 match subCommand with
103106 | Info ->
104107 printfn " %d .%d .%d " v.Major v.Minor v.Build
@@ -170,19 +173,26 @@ let main argv =
170173 let versionArg = stopParams.TryGetResult StopArguments.Version
171174 let tryKill ( returnCode , successfulErrorPrint ) ( proc : Process ) =
172175 try
176+ let fd = proc.MainModule.FileVersionInfo.FileDescription
173177 let killOrSend ( x : Process ) =
174178 if stopParams.Contains Force then
175179 x.Kill()
176- printfn " Stopped wsfscservice with PID=%i " x.Id
180+ printfn " Stopped %s with PID=%i " fd x.Id
177181 ( 0 , true )
178182 else
179183 let clientPipe = clientPipeForLocation x.MainModule.FileName
180184 sendOneMessage clientPipe { args = [| " exit" |]}
181- printfn " Stop signal sent to WebSharper Booster with PID=%i " x.Id
185+ printfn " Stop signal sent to %s with PID=%i " fd x.Id
182186 ( 0 , true )
183187 match versionArg with
184- | Some v ->
185- if proc.MainModule.FileVersionInfo.FileVersion = v then
188+ | Some v ->
189+ let versionToMatch =
190+ let regex = Regex.Match( fd, pattern, regexOptions)
191+ if regex.Success then
192+ regex.Value
193+ else
194+ proc.MainModule.FileVersionInfo.FileVersion
195+ if versionToMatch = v then
186196 killOrSend proc
187197 else
188198 if returnCode <> 0 then
@@ -212,11 +222,19 @@ let main argv =
212222 returnCode
213223 with
214224 | _ -> 1
215- | List ->
225+ | List ->
216226 try
217227 let procInfos =
218228 Process.GetProcessesByName( " wsfscservice" )
219- |> Array.map ( fun proc -> sprintf " version: %s ; path: %s " proc.MainModule.FileVersionInfo.FileVersion proc.MainModule.FileName)
229+ |> Array.map ( fun proc ->
230+ let versionToQueryBy =
231+ let regex = Regex.Match( proc.MainModule.FileVersionInfo.FileDescription, pattern, regexOptions)
232+ if regex.Success then
233+ regex.Value
234+ else
235+ proc.MainModule.FileVersionInfo.FileVersion
236+ sprintf " version: %s ; path: %s " versionToQueryBy proc.MainModule.FileName
237+ )
220238 if procInfos.Length = 0 then
221239 printfn " There are no wsfscservices running."
222240 else
0 commit comments