Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ofek committed Mar 24, 2024
1 parent 48c32c5 commit d6f49fb
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ If you are packaging a graphical user interface (GUI), you can set `PYAPP_IS_GU

On Windows, this will use `pythonw.exe` instead of `python.exe` to execute [the application](https://docs.python.org/3/using/windows.html#python-application), which avoids a console window from appearing. Running a GUI application with `pythonw.exe` means that all `stdout` and `stderr` output from your GUI will be discarded.

Otherwise, the application will execute as usual. PyApp will run your GUI by spawning a new process, such that the console window that calls runs the application terminates after successful spawning.
Otherwise, the application will execute as usual. PyApp will run your GUI by spawning a new process, such that the console window that runs the application terminates after successful spawning.

Even when `PYAPP_IS_GUI` is enabled you can still run the application from the command line. Furthermore, PyApp-specific logic (e.g. installation and setup) will still display a console window with status messages.

!!! note
On macOS, the console by default does not automatically close when processes have terminated (however it can be closed manually without interferring with the GUI). The default console behavior [can be changed](https://stackoverflow.com/questions/5560167/osx-how-to-auto-close-terminal-window-after-the-exit-command-executed) in the user settings to close after the last process terminated successfully.
On macOS, the console by default does not automatically close when processes have terminated (however it can be closed manually without interferring with the GUI). The default console behavior [can be changed](https://stackoverflow.com/questions/5560167/osx-how-to-auto-close-terminal-window-after-the-exit-command-executed) in the user settings to close after the last process terminates successfully.

## Python distribution

Expand Down
2 changes: 1 addition & 1 deletion src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ pub fn pip_external() -> bool {
env!("PYAPP_PIP_EXTERNAL") == "1"
}

pub fn app_is_gui() -> bool {
pub fn is_gui() -> bool {
env!("PYAPP_IS_GUI") == "1"
}

Expand Down
2 changes: 1 addition & 1 deletion src/distribution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub fn run_project() -> Result<()> {

#[cfg(windows)]
{
if app::app_is_gui() {
if app::is_gui() {
command = python_command(&app::pythonw_path());
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/process.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::io::Read;
#[cfg(unix)]
use std::os::unix::process::CommandExt;
// #[cfg(windows)]
use std::process::exit;
use std::process::{Command, ExitStatus};

Expand Down Expand Up @@ -41,7 +40,7 @@ pub fn exec(mut command: Command) -> Result<()> {

#[cfg(windows)]
pub fn exec(mut command: Command) -> Result<()> {
if app::app_is_gui() {
if app::is_gui() {
exec_gui(command)
} else {
let status = command.status()?;
Expand Down

0 comments on commit d6f49fb

Please sign in to comment.