{
Console.Write("Hello ");
- // If the caller wants the app to start and wait,
- // it provides the name of a lock-file to write.
- // In this case, this test app creates the lock file
- // and waits until the file is deleted.
- if (args.Length > 0)
+ // If the caller wants the app to start and wait, it provides the names of two files.
+ // In this case, this test app creates the waitFile, and waits until resumeFile is created
+ if (args.Length == 2)
{
- string writeFile = args[0];
+ string waitFile = args[0];
+ string resumeFile = args[1];
- var fs = File.Create(writeFile);
- fs.Close();
+ File.Create(waitFile).Close();
Thread.Sleep(200);
- while (File.Exists(writeFile))
+ while (!File.Exists(resumeFile))
{
Thread.Sleep(100);
}
var fixture = sharedTestState.TestFixture.Copy();
string singleFile = BundleHelper.GetPublishedSingleFilePath(fixture);
string renameFile = Path.Combine(BundleHelper.GetPublishPath(fixture), Path.GetRandomFileName());
- string writeFile = Path.Combine(BundleHelper.GetPublishPath(fixture), "lock");
+ string waitFile = Path.Combine(BundleHelper.GetPublishPath(fixture), "wait");
+ string resumeFile = Path.Combine(BundleHelper.GetPublishPath(fixture), "resume");
if (!renameFirstRun)
{
.HaveStdOutContaining("Hello World!");
}
- var singleExe = Command.Create(singleFile, writeFile)
+ // Once the App starts running, it creates the waitFile, and waits until resumeFile file is created.
+ var singleExe = Command.Create(singleFile, waitFile, resumeFile)
.CaptureStdErr()
.CaptureStdOut()
.Start();
- // Once the App starts running, it creates the writeFile, and waits until the file is deleted.
- while (!File.Exists(writeFile))
+ while (!File.Exists(waitFile))
{
Thread.Sleep(100);
}
File.Move(singleFile, renameFile);
- File.Delete(writeFile);
+ File.Create(resumeFile).Close();
var result = singleExe.WaitForExit(fExpectedToFail: false);