Skip to content

Commit

Permalink
Allow long running child process (#56)
Browse files Browse the repository at this point in the history
* Allow for long running child process, but add warning

* Update Version
  • Loading branch information
mwasplund authored Aug 5, 2020
1 parent 5def8e0 commit 4115e80
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Source/Build/Execute/BuildRunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ namespace Soup::Build::Execute
auto stdErr = process->GetStandardError();
auto exitCode = process->GetExitCode();

// Check the result of the monitor
callback->VerifyResult();

// Retrieve the input/output files
// TODO: Verify opertation output matches input
auto runtimeInput = callback->GetInput();
Expand Down
12 changes: 12 additions & 0 deletions Source/Build/Execute/SystemAccessTracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,20 @@ namespace Soup::Build
{
public:
SystemAccessTracker() :
m_activeProcessCount(0),
m_input(),
m_output()
{
}

void VerifyResult()
{
if (m_activeProcessCount != 0)
{
Log::Warning("A child process is still running in the background");
}
}

std::set<std::string> GetInput()
{
return m_input;
Expand All @@ -24,11 +33,13 @@ namespace Soup::Build
void OnInitialize() override final
{
Log::Diag("SystemAccessTracker::OnInitialize");
m_activeProcessCount++;
}

void OnShutdown() override final
{
Log::Diag("SystemAccessTracker::OnShutdown");
m_activeProcessCount--;
}

void OnError(std::string_view message) override final
Expand Down Expand Up @@ -1107,6 +1118,7 @@ namespace Soup::Build
fileName == "CONOUT$";
}

int m_activeProcessCount;
std::set<std::string> m_input;
std::set<std::string> m_inputMissing;
std::set<std::string> m_output;
Expand Down
2 changes: 1 addition & 1 deletion Source/Client/CLI/Commands/VersionCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace Soup::Client

// TODO var version = Assembly.GetExecutingAssembly().GetName().Version;
// Log::Message($"{version.Major}.{version.Minor}.{version.Build}");
Log::HighPriority("0.8.3");
Log::HighPriority("0.8.4");
}

private:
Expand Down
2 changes: 1 addition & 1 deletion Source/Client/CLI/Recipe.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name = "Soup"
Version = "0.8.3"
Version = "0.8.4"
Type = "Executable"

# Ensure the core build extensions are runtime dependencies
Expand Down
2 changes: 1 addition & 1 deletion Source/Extensions/RecipeBuild/Tasks/ResolveToolsTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ namespace RecipeBuild
});

// Check if we should include pre-release versions
bool includePrerelease = true;
bool includePrerelease = false;
if (includePrerelease)
{
argumentList.push_back("-prerelease");
Expand Down
5 changes: 3 additions & 2 deletions Source/Monitor/Shared/WindowsDetourProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ namespace Monitor
// Read until we get a client and then all clients disconnect
m_hasAnyClients = false;
m_activeClientCount = 0;
while (!m_hasAnyClients || m_activeClientCount > 0)
while ((!m_hasAnyClients || m_activeClientCount > 0) && m_processRunning)
{
// Wait for any of the pipe instances to signal
// This indicates that either a client connected to wrote to
Expand All @@ -338,7 +338,8 @@ namespace Monitor
case WAIT_TIMEOUT:
if (!m_processRunning)
{
throw std::runtime_error("The child process exited unexpectedly");
DebugTrace("Main process exited while children still running");
continue;
}
else
{
Expand Down

0 comments on commit 4115e80

Please sign in to comment.