summaryrefslogtreecommitdiff
path: root/runtime/ops/tty.rs
AgeCommit message (Collapse)Author
2024-10-22refactor(runtime/ops): use concrete error types (#26409)Leo Kettmeir
2024-10-19chore: update nix crate (#26422)Leo Kettmeir
Dedupes nix dependency, since `rustyline` depends on a newer version that what we currently use
2024-08-12fix(runtime/windows): fix calculation of console size (#23873)Roy Ivy III
2024-05-29fix(ext/node): windows cancel stdin read in line mode (#23969)Divy Srivastava
This patch fixes stdin read hanging on user input when switching tty mode on Windows Fixes #21111 On Windows, when switching from line to raw mode: - Cancel ongoing console read by writing a return keypress to its input buffer. This blocks the main thread until any ongoing read has been cancelled to prevent interference with the screen state. - On the read thread, restore the cursor position to where it was before writing the enter, undoing its effect on the screen state. - Restart reading and notify the main thread.
2024-03-06chore: upgrade deno_core (#22725)Nathan Whitaker
<!-- Before submitting a PR, please read https://docs.deno.com/runtime/manual/references/contributing 1. Give the PR a descriptive title. Examples of good title: - fix(std/http): Fix race condition in server - docs(console): Update docstrings - feat(doc): Handle nested reexports Examples of bad title: - fix #7123 - update docs - fix bugs 2. Ensure there is a related issue and it is referenced in the PR text. 3. Ensure there are tests that cover the changes. 4. Ensure `cargo test` passes. 5. Ensure `./tools/format.js` passes without changing files. 6. Ensure `./tools/lint.js` passes. 7. Open as a draft PR if your work is still in progress. The CI won't run all steps, but you can add '[ci]' to a commit message to force it to. 8. If you would like to run the benchmarks on the CI, add the 'ci-bench' label. -->
2024-02-18feat(fs): `Deno.FsFile.{isTerminal,setRaw}()` (#22234)Asher Gomez
Closes #22229. --------- Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-01-24feat: `Deno.{stdin,stdout,stderr}.isTerminal()`, deprecate `Deno.isatty()` ↵Asher Gomez
(#22011) This change: 1. Implements `Deno.stdin.isTerminal()`, `Deno.stdout.isTerminal()` and `Deno.stderr.isTerminal()`. 2. Deprecates `Deno.isatty()` for removal in Deno v2, in favour of the above instance methods. 3. Replaces use of `Deno.isatty()` with the above instance methods. Related #21995 --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-01-11fix(web): use rustyline for prompt (#21893)Divy Srivastava
Workaround until https://github.com/kkawakam/rustyline/pull/759
2024-01-02Revert "fix(runtime): Make native modal keyboard interaction consistent with ↵Divy Srivastava
browsers" (#21739) Reverts denoland/deno#18453 Fixes https://github.com/denoland/deno/issues/21602 https://github.com/denoland/deno/issues/21631 https://github.com/denoland/deno/issues/21641 Reasons for revert: - alert() and confirm() swallowed ^C with raw mode. - prompt() did not re-raise the interrupt signal from rustyline. - Default 'Y' on confirm() is a bad default and breaking change. cc @lionel-rowe
2024-01-01chore: update copyright to 2024 (#21753)David Sherret
2023-12-13fix(runtime): Make native modal keyboard interaction consistent with ↵lionel-rowe
browsers (#18453) Fixes https://github.com/denoland/deno/issues/18223. Fixes https://github.com/denoland/deno/issues/21477 --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: David Sherret <dsherret@gmail.com>
2023-11-04perf: lazy `atexit` setup (#21053)Divy Srivastava
`libc::atexit` incurrs 2% dyld cost at startup on macOS. This PR moves the setup to when the tty mode is changed using op_stdin_set_raw.
2023-10-28chore: use is_terminal in atty (#21010)Divy Srivastava
2023-09-21refactor: rewrite some ops to op2 macro (#20603)Bartek Iwańczuk
2023-09-12refactor: rewrite runtime/ ops to op2 (#20459)Bartek Iwańczuk
2023-08-25chore(cli): remove atty crate (#20275)Matt Mastracci
Removes a crate with an outstanding vulnerability.
2023-08-01chore: fix windows clippy errors (#20014)David Sherret
2023-08-01refactor(runtime): use new fd methods from resource table (#20010)Matt Mastracci
Prereq for fast streams work. No longer need `#[cfg]` around `backing_fd`.
2023-07-31refactor: update core extension api usage (#19952)Nayeem Rahman
2023-06-03refactor(core): remove force_op_registration and cleanup ↵Nayeem Rahman
JsRuntimeForSnapshot (#19353) Addresses https://github.com/denoland/deno/pull/19308#discussion_r1212248194. Removes force_op_registration as it is no longer necessary.
2023-05-04refactor(ext/fs): boxed deno_fs::FileSystem (#18945)David Sherret
1. Boxed `File` and `FileSystem` to allow more easily passing this through the CLI code (as shown within this pr). 2. `StdFileResource` is now `FileResource`. `FileResource` now contains an `Rc<dyn File>`.
2023-05-02refactor(ext/io): move tty metadata to separate collection (#18959)David Sherret
This removes the tty stuff that's hanging on the file resources and instead stores them in a separate `TtyModeStore`. Although this will cause the tty store items to not be removed when the resource is removed, I think this is ok to do because there will be a small number of resources this is every done with and usually those resources won't ever be closed.
2023-03-18Reland "perf(core): preserve ops between snapshots (#18080)" (#18272)Bartek Iwańczuk
Relanding 4b6305f4f25fc76f974bbdcc9cdb139d5ab8f5f4
2023-03-18Revert "perf(core): preserve ops between snapshots (#18080)" (#18267)Bartek Iwańczuk
This reverts commit 4b6305f4f25fc76f974bbdcc9cdb139d5ab8f5f4.
2023-03-18perf(core): preserve ops between snapshots (#18080)Bartek Iwańczuk
This commit changes the build process in a way that preserves already registered ops in the snapshot. This allows us to skip creating hundreds of "v8::String" on each startup, but sadly there is still some op registration going on startup (however we're registering 49 ops instead of >200 ops). This situation could be further improved, by moving some of the ops from "runtime/" to a separate extension crates. --------- Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-03-17feat(core) deno_core::extension! macro to simplify extension registration ↵Matt Mastracci
(#18210) This implements two macros to simplify extension registration and centralize a lot of the boilerplate as a base for future improvements: * `deno_core::ops!` registers a block of `#[op]`s, optionally with type parameters, useful for places where we share lists of ops * `deno_core::extension!` is used to register an extension, and creates two methods that can be used at runtime/snapshot generation time: `init_ops` and `init_ops_and_esm`. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-03-08fix(runtime/windows): ensure `Deno.stdin.setRaw(false)` properly disables ↵Roy Ivy III
raw mode (#17983)
2023-03-05refactor(runtime): factor out deno_io extension crate (#18001)Bartek Iwańczuk
This is a prerequisite to factor out FS ops to a separate crate.
2023-01-14chore: use rustfmt imports_granularity option (#17421)Divy Srivastava
Closes https://github.com/denoland/deno/issues/2699 Closes https://github.com/denoland/deno/issues/2347 Uses unstable rustfmt features. Since dprint invokes `rustfmt` we do not need to switch the cargo toolchain to nightly. Do we care about formatting stability of our codebase across Rust versions? (I don't)
2023-01-08feat(core): allow specifying name and dependencies of an Extension (#17301)Leo Kettmeir
2023-01-02chore: update copyright year to 2023 (#17247)David Sherret
Yearly tradition of creating extra noise in git.
2022-12-12feat: improve download progress bar (#16984)Bartek Iwańczuk
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-12-05fix(windows): support special key presses in raw mode (#16904)David Sherret
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-10-26feat: Stabilize Deno.consoleSize() API (#15933)Bartek Iwańczuk
This commit stabilizes "Deno.consoleSize()" API. There is one change compared to previous unstable API, in that the API doesn't accept any arguments. Console size is established by querying syscalls for stdio streams at fd 0, 1 and 2.
2022-10-24feat: Stabilize Deno.stdin.setRaw() (#16399)Bartek Iwańczuk
2022-09-28feat(unstable): Deno.setRaw -> Deno.stdin.setRaw (#15797)Luca Casonato
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-09-23perf: use fast ops for tty (#15976)Divy Srivastava
2022-09-04fix(cli): allow using file resource synchronously while being used async ↵David Sherret
(#15747)
2022-07-15chore: fix Windows specific clippy errors (#15212)David Sherret
2022-07-13fix(cli): synchronize async stdio/file reads and writes (#15092)David Sherret
Fixes a regression where async writes and reads could get out of order.
2022-06-26build: require safety comments on unsafe code (#13870)Luca Casonato
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2022-05-11fix: stdout and stderr encoding on Windows (#14559)David Sherret
2022-05-10refactor: remove unused `Option`s on `StdFileResource.fs_file` (#14549)David Sherret
2022-04-19perf(runtime): bypass tokio file and bump op buffer size to 64K (#14319)Divy Srivastava
2022-03-14feat(ops): custom arity (#13949)Aaron O'Mullan
Also cleanup & drop ignored wildcard op-args
2022-03-14feat(core): codegen ops (#13861)Divy Srivastava
Co-authored-by: Aaron O'Mullan <aaron.omullan@gmail.com>
2022-01-07chore: update copyright to 2022 (#13306)Ryan Dahl
Co-authored-by: Erfan Safari <erfanshield@outlook.com>
2021-08-15refactor(ops): return BadResource errors in ResourceTable calls (#11710)Aaron O'Mullan
* refactor(ops): return BadResource errors in ResourceTable calls Instead of relying on callers to map Options to Results via `.ok_or_else(bad_resource_id)` at over 176 different call sites ...
2021-08-03chore: surface import map JSON parse error to user (#11573)David Sherret
2021-05-08cleanup(ops): remove unused ZeroCopyBuf arg-types (#10530)Aaron O'Mullan