Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/process module #51

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Feature/process module #51

wants to merge 13 commits into from

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.

3 participants