Skip to content
This repository was archived by the owner on Oct 4, 2021. It is now read-only.

Commit 5bf9e66

Browse files
committed
Don't wait for commands unless they're ready to activate
1 parent c7eef43 commit 5bf9e66

File tree

1 file changed

+14
-6
lines changed
  • main/tests/UserInterfaceTests

1 file changed

+14
-6
lines changed

main/tests/UserInterfaceTests/Ide.cs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,20 @@ public static void OpenFile (FilePath file)
5252

5353
public static void CloseAll (bool exit = true)
5454
{
55-
Session.RunAndWaitForTimer (() => {
56-
Session.ExecuteCommand (FileCommands.SaveAll);
57-
}, "Ide.Shell.SaveAll");
58-
Session.RunAndWaitForTimer (() => {
59-
Session.ExecuteCommand (FileCommands.CloseWorkspace);
60-
}, "Ide.Shell.CloseWorkspace");
55+
var isDirty = (bool)Session.GetGlobalValue ("MonoDevelop.Ide.IdeApp.Workbench.DocumentsDirty");
56+
if (isDirty) {
57+
Session.RunAndWaitForTimer (() => {
58+
Session.ExecuteCommand (FileCommands.SaveAll);
59+
}, "Ide.Shell.SaveAll");
60+
}
61+
62+
var workspaceOpen = (bool)Session.GetGlobalValue ("MonoDevelop.Ide.IdeApp.Workspace.IsOpen");
63+
if (workspaceOpen) {
64+
Session.RunAndWaitForTimer (() => {
65+
Session.ExecuteCommand (FileCommands.CloseWorkspace);
66+
}, "Ide.Shell.CloseWorkspace");
67+
}
68+
6169
if (exit)
6270
Session.ExitApp ();
6371
}

0 commit comments

Comments
 (0)