Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
crowlKats committed Oct 19, 2024
1 parent 23853ed commit 8f3614f
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 40 deletions.
39 changes: 8 additions & 31 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ quote = "1"
syn = { version = "2", features = ["full", "extra-traits"] }

# unix
nix = "=0.26.2"
nix = "=0.27.1"

# windows deps
junction = "=0.2.0"
Expand Down
2 changes: 1 addition & 1 deletion ext/fs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ serde.workspace = true
thiserror.workspace = true

[target.'cfg(unix)'.dependencies]
nix.workspace = true
nix = { workspace = true, features = ["user"] }

[target.'cfg(windows)'.dependencies]
winapi = { workspace = true, features = ["winbase"] }
Expand Down
6 changes: 3 additions & 3 deletions runtime/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ fn get_tty_error(error: &TtyError) -> &'static str {
get_error_class_name(e).unwrap_or("Error")
}
TtyError::Io(e) => get_io_error_class(e),
TtyError::Errno(e) => get_io_error_class(&(*e).into()),
TtyError::Errno(e) => get_nix_error_class(e),
}
}

Expand All @@ -845,7 +845,7 @@ fn get_readline_error(error: &ReadlineError) -> &'static str {
ReadlineError::Eof => "Error",
ReadlineError::Interrupted => "Error",
#[cfg(unix)]
ReadlineError::Errno(e) => get_io_error_class(&(*e).into()),
ReadlineError::Errno(e) => get_nix_error_class(e),
ReadlineError::WindowResized => "Error",
#[cfg(windows)]
ReadlineError::Decode(_) => "Error",
Expand Down Expand Up @@ -904,7 +904,7 @@ fn get_process_error(error: &ProcessError) -> &'static str {
ProcessError::Signal(e) => get_signal_error(e),
ProcessError::MissingCmd => "Error",
ProcessError::InvalidPid => "TypeError",
ProcessError::Errno(e) => get_io_error_class(&(*e).into()),
ProcessError::Errno(e) => get_nix_error_class(e),
}
}

Expand Down
2 changes: 1 addition & 1 deletion runtime/ops/tty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ fn op_set_raw(
let tty_mode_store = state.borrow::<TtyModeStore>().clone();
let previous_mode = tty_mode_store.get(rid);

let raw_fd = handle_or_fd;
let raw_fd = unsafe { std::os::fd::BorrowedFd::borrow_raw(handle_or_fd) };

if is_raw {
let mut raw = match previous_mode {
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/process_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,9 @@ Deno.test(
error = e;
}

console.log(error);
throw error;

assert(
error instanceof Deno.errors.NotFound ||
// On Windows, the underlying Windows API may return
Expand Down
2 changes: 1 addition & 1 deletion tests/util/server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ lazy-regex.workspace = true
libc.workspace = true
lsp-types.workspace = true
monch.workspace = true
nix.workspace = true
nix = { workspace = true, features = ["fs", "term", "signal"] }
once_cell.workspace = true
os_pipe.workspace = true
parking_lot.workspace = true
Expand Down
6 changes: 4 additions & 2 deletions tests/util/server/src/pty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,12 @@ fn setup_pty(fd: i32) {
use nix::sys::termios::tcsetattr;
use nix::sys::termios::SetArg;

let mut term = tcgetattr(fd).unwrap();
let as_fd = unsafe { std::os::fd::BorrowedFd::borrow_raw(fd) };

let mut term = tcgetattr(as_fd).unwrap();
// disable cooked mode
term.local_flags.remove(termios::LocalFlags::ICANON);
tcsetattr(fd, SetArg::TCSANOW, &term).unwrap();
tcsetattr(as_fd, SetArg::TCSANOW, &term).unwrap();

// turn on non-blocking mode so we get timeouts
let flags = fcntl(fd, FcntlArg::F_GETFL).unwrap();
Expand Down

0 comments on commit 8f3614f

Please sign in to comment.