Skip to content

Commit c85a278

Browse files
committed
more terminal work
1 parent 132982a commit c85a278

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

src-tauri/src/terminal.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ pub async fn create_terminal(
3232
window: Window,
3333
term_info: State<'_, TermManager>,
3434
shell: Option<String>,
35+
directory: Option<String>,
3536
) -> Result<String, String> {
37+
println!(
38+
"Creating terminal with shell: {:?} and directory: {:?}",
39+
shell, directory
40+
);
3641
let pty_system = native_pty_system();
3742
let pair = pty_system
3843
.openpty(PtySize {
@@ -56,12 +61,18 @@ pub async fn create_terminal(
5661
}
5762
}
5863
};
59-
let cmd = CommandBuilder::new(command);
64+
let mut cmd = CommandBuilder::new(command);
65+
cmd.cwd(directory.unwrap_or_else(|| String::from(".")));
6066
let child = pair
6167
.slave
6268
.spawn_command(cmd)
6369
.map_err(|e| format!("Failed to spawn shell command in pty: {}", e.to_string()))?;
6470

71+
println!(
72+
"Spawned terminal process with PID: {:?}",
73+
child.process_id()
74+
);
75+
6576
let mut reader = pair.master.try_clone_reader().unwrap();
6677
let writer = pair.master.take_writer().unwrap();
6778

src/components/Tiles/MultiTerminal.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ export default function MultiTerminal({}: {}) {
1818
const [shell] = useStore<string | null>("terminal/shell", null);
1919

2020
const createTerm = useCallback(async () => {
21+
console.log("creating terminal with shell:", shell);
2122
const id = await invoke<string>("create_terminal", {
2223
shell: shell !== "" ? shell : null,
2324
});
25+
console.log("Created terminal with ID:", id);
2426
setTerminals((old) => {
2527
return [...old, id];
2628
});
@@ -62,7 +64,13 @@ export default function MultiTerminal({}: {}) {
6264
height: "100%",
6365
}}
6466
>
65-
<TabList>
67+
<TabList
68+
sx={{
69+
"& .MuiTab-root": {
70+
whiteSpace: "nowrap",
71+
},
72+
}}
73+
>
6674
{terminals.map((t) => (
6775
<Tab key={t} value={t}>
6876
{t}

0 commit comments

Comments
 (0)