Skip to content

Conversation

@isdampe
Copy link
Contributor

@isdampe isdampe commented Aug 8, 2022

This is the first step towards decoupling OS-specific process functions so they can be used from a single module across any supported OS.

I've tested on macOS and Linux, and until someone can test on Windows (or I can get access to a Windows environment) the old code paths will remain active via the conditional macros.

To avoid major problems and giant refactors, I will try and "stagger" the implementation of this over a series of updates / branches

@isdampe isdampe requested a review from lachfoy August 8, 2022 12:25
@isdampe
Copy link
Contributor Author

isdampe commented Aug 8, 2022

2e519ed adds support for asynchronous process execution, streaming stdout and stderr back into a std::vector<std::string>. @studioant I'll do some testing / porting on Windows later in the week - but then I'm pretty sure we'll be able to tackle the loading screen using something like

// Before main loop...
auto git_output = std::vector<std::string>();
auto p = Arcade::Process("git", std::vector<std::string> {"clone", url});
p.execute_async(buffer);

// Main loop
while (! quit_requested()) {
	process_events();

	// Draw loading screen...
	
	// Draw the most recent chunk of text receievd from git
	draw_text(git_output.back(), /* etc */);

	refresh_screen();
}

@studioant
Copy link
Contributor

2e519ed adds support for asynchronous process execution, streaming stdout and stderr back into a std::vector<std::string>. @studioant I'll do some testing / porting on Windows later in the week - but then I'm pretty sure we'll be able to tackle the loading screen using something like

// Before main loop...
auto git_output = std::vector<std::string>();
auto p = Arcade::Process("git", std::vector<std::string> {"clone", url});
p.execute_async(buffer);

// Main loop
while (! quit_requested()) {
	process_events();

	// Draw loading screen...
	
	// Draw the most recent chunk of text receievd from git
	draw_text(git_output.back(), /* etc */);

	refresh_screen();
}

Interesing.. I don't have an env to test this on, but keen to see this in action

@isdampe
Copy link
Contributor Author

isdampe commented Aug 29, 2022

// Before main loop...
auto p = new ArcadeProcess("git", std::vector<std::string> {"clone", url});
p->execute_async();

// Main loop
while (! quit_requested()) {
	process_events();

	// Draw loading screen...
	
	// Draw the most recent chunk of text receievd from git
	draw_text(p->output_stream.back(), /* etc */);

	refresh_screen();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants