Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions when_changed/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand All @@ -37,6 +38,8 @@ public static void Run()
return;
}

b_allow_dirty = args.Contains("--dirty");

String thingToWatch = args[1];
FileSystemWatcher watcher = createWatcher(thingToWatch);

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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)
{
Expand Down