diff --git a/src/main.rs b/src/main.rs index c61bf6f..db22f4d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,7 +16,15 @@ fn exec(command: &str) { use std::process::Command; let mut parts = command.split_whitespace(); let command = parts.next().unwrap(); - let args = parts; + let mut args = parts; + + // cdコマンドの場合set_current_dirを使う + if command == "cd" { + let dir = args.next().unwrap(); + std::env::set_current_dir(dir).expect("Failed to change directory"); + return; + } + let status = Command::new(command) .args(args) .status()