Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ cargo build --release --features metal # Apple Silicon
│ │
│ ┌───────────┐ ┌─────────────┐ ┌──────────────────────┐ │
│ │ Your │ pty │ Shell │ hook │ Unix Socket │ │
│ │ Terminal │◄─────►│ (zsh/bash) │─────►│ /tmp/wake-*.sock │ │
│ │ Terminal │◄─────►│ (zsh/bash) │─────►│ ~/.wake/sockets/* │ │
│ └───────────┘ └─────────────┘ └──────────┬───────────┘ │
│ │ │ │ │
│ │ │ stdout │ cmd events │
Expand Down
1 change: 1 addition & 0 deletions crates/wake-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ chrono.workspace = true
signal-hook.workspace = true
signal-hook-tokio.workspace = true
anyhow.workspace = true
dirs.workspace = true
term_size.workspace = true
libc.workspace = true

Expand Down
10 changes: 9 additions & 1 deletion crates/wake-cli/src/commands/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,15 @@ struct SessionState {

pub async fn run() -> Result<()> {
let session_id = uuid::Uuid::new_v4().to_string();
let socket_path = format!("/tmp/wake-{session_id}.sock");

// Use ~/.wake/sockets/ instead of /tmp/ to avoid world-writable directory risks
let socket_dir = dirs::home_dir()
.context("Could not determine home directory")?
.join(".wake")
.join("sockets");
std::fs::create_dir_all(&socket_dir).context("Failed to create socket directory")?;
let socket_path = socket_dir.join(format!("wake-{session_id}.sock"));
let socket_path = socket_path.to_string_lossy().to_string();

// Clean up any stale socket
let _ = std::fs::remove_file(&socket_path);
Expand Down