Skip to content

Commit

Permalink
[Fixed] Failed to activate store apps. #12 #17
Browse files Browse the repository at this point in the history
Use absolute path to refer to ActivateStoreApp.exe.
  • Loading branch information
imsardine committed Aug 20, 2015
1 parent b49aca1 commit 6187bc6
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions src/WinAppDriver/Modern/StoreApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,36 @@ public bool IsInstalled()

public void Activate()
{
// TODO thorw exception if needed
Process.Start("ActivateStoreApp", this.AppUserModelId);
logger.Info(
"Activate the store app; current working directory = [{0}], " +
"AppUserModelID = [{1}].",
Environment.CurrentDirectory, this.AppUserModelId);

var info = new ProcessStartInfo(
Path.Combine(Environment.CurrentDirectory, "ActivateStoreApp.exe"),
this.AppUserModelId);
info.UseShellExecute = false;
info.RedirectStandardOutput = true;
info.RedirectStandardError = true;

var process = Process.Start(info);
logger.Debug("PID of ActivateStoreApp.exe = {0}.", process.Id);
process.WaitForExit(5 * 1000);

if (process.ExitCode == 0)
{
logger.Debug("STDOUT = [{0}].", process.StandardOutput.ReadToEnd());
}
else
{
string msg = string.Format(
"Error occurred while activating the store app; " +
"code = {0}, STDOUT = [{1}], STDERR = [{2}].",
process.ExitCode,
process.StandardOutput.ReadToEnd(),
process.StandardError.ReadToEnd());
throw new WinAppDriverException(msg);
}
}

public void Terminate()
Expand Down

0 comments on commit 6187bc6

Please sign in to comment.