Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Commit

Permalink
Fix NormalScan test with SetupProcess
Browse files Browse the repository at this point in the history
NormalScan test needs the files scanned to be added to the ScanOptions.
This was not being done. This information can be obtained from the
process-ps-plog output:

    process-ps-plog:scan:/full/path/to/file
  • Loading branch information
mrward committed Feb 8, 2021
1 parent 28be40a commit 63ae0cd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
13 changes: 12 additions & 1 deletion Mono.Addins/Mono.Addins.Database/ProcessProgressStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ static string Decode (string msg)
}

public static void MonitorProcessStatus (IProgressStatus monitor, TextReader reader, StringCollection progessLog)
{
MonitorProcessStatus (monitor, reader, progessLog, null);
}

internal static void MonitorProcessStatus (IProgressStatus monitor, TextReader reader, StringCollection progessLog, AddinFileSystemExtension fileSystemExtension)
{
string line;
string exceptionText = null;
Expand Down Expand Up @@ -145,7 +150,13 @@ public static void MonitorProcessStatus (IProgressStatus monitor, TextReader rea
monitor.Cancel ();
break;
case "process-ps-plog":
progessLog.Add (Decode (txt));
string decodedText = Decode (txt);
progessLog.Add (decodedText);
if (fileSystemExtension != null && decodedText.StartsWith("scan:", StringComparison.OrdinalIgnoreCase))
{
string file = decodedText.Substring(5);
fileSystemExtension.OpenFile (file);
}
break;
default:
wasTag = false;
Expand Down
6 changes: 3 additions & 3 deletions Mono.Addins/Mono.Addins.Database/SetupProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void Scan (IProgressStatus monitor, AddinRegistry registry, string scanFo
{
var data = new List<string> (context.Write ());

ExecuteCommand (monitor, registry.RegistryPath, registry.StartupDirectory, registry.DefaultAddinsFolder, registry.AddinCachePath, "scan", scanFolder, data);
ExecuteCommand (monitor, registry.RegistryPath, registry.StartupDirectory, registry.DefaultAddinsFolder, registry.AddinCachePath, "scan", scanFolder, data, context.FileSystemExtension);
}

public void GenerateScanDataFiles (IProgressStatus monitor, AddinRegistry registry, string scanFolder, bool recursive)
Expand All @@ -58,7 +58,7 @@ public void GetAddinDescription (IProgressStatus monitor, AddinRegistry registry
ExecuteCommand (monitor, registry.RegistryPath, registry.StartupDirectory, registry.DefaultAddinsFolder, registry.AddinCachePath, "get-desc", file, new List<string> { outFile });
}

internal static void ExecuteCommand (IProgressStatus monitor, string registryPath, string startupDir, string addinsDir, string databaseDir, string name, string arg1, List<string> data)
internal static void ExecuteCommand (IProgressStatus monitor, string registryPath, string startupDir, string addinsDir, string databaseDir, string name, string arg1, List<string> data, AddinFileSystemExtension fileSystemExtension = null)
{
string verboseParam = monitor.LogLevel.ToString ();

Expand Down Expand Up @@ -104,7 +104,7 @@ internal static void ExecuteCommand (IProgressStatus monitor, string registryPat
process.StandardInput.Flush ();

StringCollection progessLog = new StringCollection ();
ProcessProgressStatus.MonitorProcessStatus (monitor, process.StandardOutput, progessLog);
ProcessProgressStatus.MonitorProcessStatus (monitor, process.StandardOutput, progessLog, fileSystemExtension);
process.WaitForExit ();
if (process.ExitCode != 0)
throw new ProcessFailedException (progessLog);
Expand Down

0 comments on commit 63ae0cd

Please sign in to comment.