term: fix terminal not being set for shell process

This commit is contained in:
2025-06-22 10:55:48 +03:00
parent 94a1587771
commit 69fb239dde
5 changed files with 26 additions and 0 deletions
+15
View File
@@ -41,6 +41,7 @@ pub struct Config {
pub colors: ColorsConfig,
}
#[cfg(any(rust_analyzer, target_os = "yggdrasil"))]
impl Default for FontConfig {
fn default() -> Self {
Self {
@@ -53,6 +54,20 @@ impl Default for FontConfig {
}
}
#[cfg(any(rust_analyzer, unix))]
impl Default for FontConfig {
fn default() -> Self {
// TODO query fontconfig for monospace
Self {
regular: PathBuf::from("/usr/share/fonts/TTF/DejaVuSansMono.ttf"),
italic: PathBuf::from("/usr/share/fonts/TTF/DejaVuSansMono-Oblique.ttf"),
bold: PathBuf::from("/usr/share/fonts/TTF/DejaVuSansMono-Bold.ttf"),
bold_italic: PathBuf::from("/usr/share/fonts/TTF/DejaVuSansMono-BoldOblique.ttf"),
size: 16,
}
}
}
impl Default for ColorsConfig {
fn default() -> Self {
Self {
+1
View File
@@ -380,6 +380,7 @@ impl Terminal<'_> {
.stdin(Stdio::from_raw_fd(pty_slave_stdin))
.stdout(Stdio::from_raw_fd(pty_slave_stdout))
.stderr(Stdio::from_raw_fd(pty_slave_stderr))
.create_session()?
.create_process_group()?
.spawn()?
};
+1
View File
@@ -1,5 +1,6 @@
use std::io;
pub trait CommandSpawnExt {
fn create_session(&mut self) -> io::Result<&mut Self>;
fn create_process_group(&mut self) -> io::Result<&mut Self>;
}
+5
View File
@@ -64,4 +64,9 @@ impl CommandSpawnExt for Command {
fn create_process_group(&mut self) -> io::Result<&mut Self> {
Ok(self.process_group(0))
}
fn create_session(&mut self) -> io::Result<&mut Self> {
// TODO
Ok(self)
}
}
@@ -49,4 +49,8 @@ impl CommandSpawnExt for Command {
let group = unsafe { runtime::rt::sys::create_process_group() };
Ok(self.process_group(group))
}
fn create_session(&mut self) -> io::Result<&mut Self> {
Ok(unsafe { self.gain_terminal(0) })
}
}