Open webview app directly instead of using "open"

Summary:
It seems some semantics of /usr/bin/open may have changed in macOS Sonoma. We used to have `sl isl` open the generated app bundle using `/usr/bin/open /path/to/Sapling.app`. This now seems to exit immediately. I'm not quite sure why.

Instead, we can simply invoke the inner executable directly. That still opens the app, shows the webview, and appears in the dock and everything, but it doesn't exit immediately.

Reviewed By: sggutier

Differential Revision: D50939280

fbshipit-source-id: 3680e93a7dbd06d3dce63cce3d38e5a72a2c7ae1
This commit is contained in:
Evan Krause 2023-11-02 14:54:48 -07:00 committed by Facebook GitHub Bot
parent 732d132ffd
commit 32b2e936d0

View File

@ -158,11 +158,17 @@ impl ISLAppBundle {
Ok(())
}
/// Launch the app bundle in a new process via 'open'.
/// Launch the app bundle in a new process.
pub(crate) fn run_app_bundle(&self) -> anyhow::Result<()> {
// Use 'open' to run the app.
let mut command = Command::new("/usr/bin/open");
command.arg(&self.app_dir).spawn()?;
let mut command = Command::new(self.app_dir.join("Contents/MacOS/Interactive Smartlog"));
// No need to keep the stdout, since the parent process will exit immediately.
// Use --foreground to get the stdout.
command
.stdout(std::process::Stdio::null())
.stderr(std::process::Stdio::null());
command.spawn()?;
Ok(())
}