1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use super::Instance;
use crate::error::CobbleResult;
use crate::minecraft::launch::{build_launch_command, launch};
use crate::minecraft::launch_options::LaunchOptions;
use crate::minecraft::process_handle::GameProcessHandle;
use std::process::{Command, Stdio};
impl Instance {
pub fn launch_command(&self, options: &LaunchOptions) -> CobbleResult<Command> {
let version_data = self.read_version_data()?;
let command = build_launch_command(
&version_data,
self.dot_minecraft_path(),
self.libraries_path(),
self.assets_path(),
self.natives_path(),
self.log_configs_path(),
options,
)?;
Ok(command)
}
pub fn launch(&self, options: &LaunchOptions) -> CobbleResult<GameProcessHandle> {
let mut command = self.launch_command(options)?;
command
.stdout(Stdio::null())
.stdin(Stdio::null())
.stderr(Stdio::null());
launch(command)
}
}