#Command::new creates a window after building

7 messages · Page 1 of 1 (latest)

gilded mirage
#

Normally when running npm run tauri dev. The Command::new that I do doesn't open a command line window. Since I'm basically calling httpd.exe which after building my app now has a visible command line window, which should not be there.

My main.rs does have this line:
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

I got this from a GH Issue #204.

I'm basically spawning an httpd instance (Apache) and want that to be executed silently in the background similar to when I'm running via npm run tauri dev.

I hope that makes sense?

wheat relic
#
  1. Why are you launching Apache at all?
  2. Share the part where you run Command::new, the cfg_attr part only prevents a terminal window for the actual Tauri application and has zero effect on what's launched by commands
gilded mirage
#

Reason why is I'm trying to recreate xampp as a practice. The code I use Command::new is the following:

#[tauri::command]
async fn start_apache() {
    Command::new("C:/xampp/apache/bin/httpd.exe").output();
}

Like this doesn't show up when in dev, but after building it shows up. Idk why. I'm most likely doing something wrong, super new to rust and tauri. Sorry.

wheat relic
#

-k start

#

I was just asking why you ran Apache to ensure you weren't trying to serve your frontend through it, because that wouldn't make sense haha 😅

gilded mirage
#

Yup! That was it. Thank you very much! :>