diff --git a/when_changed/Program.cs b/when_changed/Program.cs index 6ab179e..883680e 100644 --- a/when_changed/Program.cs +++ b/when_changed/Program.cs @@ -18,6 +18,7 @@ class Program private static State m_state; private static Object m_state_lock = new Object(); + private static bool b_allow_dirty = false; public static void Main() { @@ -37,6 +38,8 @@ public static void Run() return; } + b_allow_dirty = args.Contains("--dirty"); + String thingToWatch = args[1]; FileSystemWatcher watcher = createWatcher(thingToWatch); @@ -123,8 +126,11 @@ private static void runCmd(string changed_file) { case State.Executing: // Oh noeeees - it changed while we were executing. do it again straight after. - Console.WriteLine(" -- output will be dirty - will run again soon..."); - m_state = State.ExecutingDirty; + if (!b_allow_dirty) + { + Console.WriteLine(" -- output will be dirty - will run again soon..."); + m_state = State.ExecutingDirty; + } break; case State.ExecutingDirty: // Leave the flag dirty. @@ -188,7 +194,7 @@ private static void waitThenRun(string filechanged) var startinfo = new ProcessStartInfo(); startinfo.FileName = m_command; - startinfo.WindowStyle = ProcessWindowStyle.Minimized; + startinfo.WindowStyle = ProcessWindowStyle.Hidden; if (m_command_args.Length > 0) {