diff options
| author | Ellie Huxtable <ellie@atuin.sh> | 2024-07-25 23:31:38 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-25 23:31:38 +0100 |
| commit | c32bbcc7edc2cf99da52b1407c90238bc781a804 (patch) | |
| tree | 4a8b307f69fb444f5c8c15a65e6f89170d9d4bbf /ui/backend/src/pty.rs | |
| parent | feat(gui): allow interacting with the embedded terminal (#2312) (diff) | |
| download | atuin-c32bbcc7edc2cf99da52b1407c90238bc781a804.zip | |
feat(gui): directory block, re-org of some code (#2314)
Diffstat (limited to 'ui/backend/src/pty.rs')
| -rw-r--r-- | ui/backend/src/pty.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ui/backend/src/pty.rs b/ui/backend/src/pty.rs index 45502892..af394d95 100644 --- a/ui/backend/src/pty.rs +++ b/ui/backend/src/pty.rs @@ -16,7 +16,7 @@ pub struct Pty { } impl Pty { - pub async fn open<'a>(rows: u16, cols: u16) -> Result<Self> { + pub async fn open<'a>(rows: u16, cols: u16, cwd: Option<String>) -> Result<Self> { let sys = portable_pty::native_pty_system(); let pair = sys @@ -28,7 +28,11 @@ impl Pty { }) .map_err(|e| eyre!("Failed to open pty: {}", e))?; - let cmd = CommandBuilder::new_default_prog(); + let mut cmd = CommandBuilder::new_default_prog(); + + if let Some(cwd) = cwd { + cmd.cwd(cwd); + } let child = pair.slave.spawn_command(cmd).unwrap(); drop(pair.slave); |
