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

Set CREATE_NO_WINDOW flag when executing Git hooks #2371

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

icorbrey
Copy link

@icorbrey icorbrey commented Sep 27, 2024

This Pull Request makes changes to accommodate GUI functionality in GitButler (see: gitbutlerapp/gitbutler#4982).

It changes the following:

  • Set the CREATE_NO_WINDOW flag when executing Git hooks on Windows.

I followed the checklist:

  • I added unittests
  • I ran make check without errors
  • I tested the overall application
  • I added an appropriate item to the changelog

@icorbrey icorbrey marked this pull request as ready for review September 27, 2024 19:17
@icorbrey
Copy link
Author

I've tested this functionality using a dev build of GitButler with the git2-hooks dependency pointed at my local copy of gitui. Please let me know if I need to do anything else to get this merged, it bothers me when using GitButler with Lefthook and I'd like to be able to get it fixed!

@extrawurst
Copy link
Owner

Thanks for the contribution! Can you fix the ci issues?

@icorbrey
Copy link
Author

Sure thing!

@icorbrey
Copy link
Author

@extrawurst that should fix it, I had forgotten to ensure this was a noop when you're not on Windows

@icorbrey
Copy link
Author

@extrawurst out of curiosity, do you have an idea of when the next release will be? Also, I believe the CI workflow requires your approval again.

/// On Windows, CLI applications that aren't the window's subsystem will
/// create and show a console window that pops up next to the main
/// application window when run. We disable this behavior by setting the
/// `CREATE_NO_WINDOW` flag.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add a link here to some place that documents this magic number? maybe even use a local constant that is named equally CREATE_NO_WINDOW?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went ahead and added the following to CommandExt:

/// The process is a console application that is being run without a
/// console window. Therefore, the console handle for the application is
/// not set.
///
/// This flag is ignored if the application is not a console application,
/// or if it used with either `CREATE_NEW_CONSOLE` or `DETACHED_PROCESS`.
///
/// See: https://learn.microsoft.com/en-us/windows/win32/procthread/process-creation-flags
const CREATE_NO_WINDOW: u32 = 0x0800_0000;

This is just the documentation for CREATE_NO_WINDOW from the linked Microsoft docs. Are you happy with this?

@extrawurst
Copy link
Owner

@icorbrey since this is a separate crate i can cut a release as soon as this is merged

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.

2 participants