Skip to content

Commit

Permalink
* Issue#33: Cleanup routine throws ArgumentException
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg-shilo committed Jan 19, 2017
1 parent 0e51b33 commit 58ce13f
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions Source/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,15 +283,9 @@ public static void CleanUnusedTmpFiles(string dir, string pattern, bool verifyPi

if (int.TryParse(pidValue, out pid))
{
try
{
if (Process.GetProcessById(pid) != null)
continue; //still running
}
catch
{
//GetProcessById will throw if pid is not running and Utils.FileDelete handles all unexpected
}
//Didn't use GetProcessById as it throws if pid is not running
if (Process.GetProcesses().Any(p => p.Id == pid))
continue; //still running
}
}
}
Expand Down Expand Up @@ -473,12 +467,12 @@ internal static void VerbosePrint(string message, ExecuteOptions options)
public static string DbgInjectionCode = DbgInjectionCodeInterface;
internal static string DbgInjectionCodeInterface = @"partial class dbg
{
public static bool publicOnly = false;
public static bool publicOnly = true;
public static bool propsOnly = false;
public static int max_items = 25;
public static int depth = 1;
public static void print(object @object){}
public static void printf(string format, params object[] args){}
public static void print(params object[] args){}
public static void printf(string format, params object[] args) { }
public static void print(object @object, params object[] args) { }
}";

internal static string GetScriptedCodeDbgInjectionCode(string scriptFileName)
Expand Down Expand Up @@ -598,7 +592,7 @@ public static string CompileResource(string file, string out_name)

var input = file;
var output = Path.ChangeExtension(file, ".resources");
if(out_name != null)
if (out_name != null)
output = Path.Combine(Path.GetDirectoryName(file), out_name);

string css_dir_res_gen = Environment.ExpandEnvironmentVariables(@"%CSSCRIPT_DIR%\lib\resgen.exe");
Expand Down Expand Up @@ -631,11 +625,11 @@ public static string CompileResource(string file, string out_name)
catch (Exception e)
{
if (!File.Exists(css_dir_res_gen))
throw new ApplicationException("Cannot invoke " + resgen_exe + ": " + e.Message +
"\nEnsure resgen.exe is in the %CSSCRIPT_DIR%\\lib or "+
"its location is in the system PATH. Alternatively you "+
"can specify the direct location of resgen.exe via "+
"CSS_RESGEN environment variable.");
throw new ApplicationException("Cannot invoke " + resgen_exe + ": " + e.Message +
"\nEnsure resgen.exe is in the %CSSCRIPT_DIR%\\lib or " +
"its location is in the system PATH. Alternatively you " +
"can specify the direct location of resgen.exe via " +
"CSS_RESGEN environment variable.");
}

if (error.Length > 0)
Expand Down

0 comments on commit 58ce13f

Please # to comment.