1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-01 09:24:20 -04:00
Commit graph

31 commits

Author SHA1 Message Date
dubiousjim
69303e2149
refactor: move code from fs.rs into ops/fs.rs (#4428)
This a complex boring PR that shifts around code (primarily) in cli/fs.rs and
cli/ops/fs.rs. The gain of this refactoring is to ease the way for #4188 and
#4017, and also to avoid some future development pain.

Mostly there is no change in functionality. Except:
* squashed bugs where op_utime and op_chown weren't using `resolve_from_cwd`
* eliminated the use of the external `remove_dir_all` crate.
* op_chmod now only queries metadata to verify file/dir exists on Windows (it
  will already fail on Unix if it doesn't)
* op_chown now verifies the file/dir's existence on Windows like chmod does.
2020-03-20 09:46:26 -04:00
dubiousjim
f9557a4ff6
Add mode option to open/create (#4289) 2020-03-16 15:02:41 -04:00
dubiousjim
6cc40b0865
BREAKING CHANGE FileInfo.len renamed to FileName.size (#4338) 2020-03-14 22:57:42 -04:00
João Souto
fb5c31416d
Add waker to StreamResource to fix hang on close bugs (#4293) 2020-03-11 18:19:24 -04:00
dubiousjim
a28fa2415f
support permission mode in mkdir (#4286) 2020-03-11 16:14:23 -04:00
dubiousjim
8078d976d2
Add Deno.umask (#4290) 2020-03-10 15:11:27 -04:00
Bartek Iwańczuk
88b77da25c
refactor: remove cli/ops/files.rs (#4246)
* "op_close" - moved to "cli/ops/resources.rs"
* "op_seek", "op_open" - moved to "cli/ops/fs.rs"

Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2020-03-07 13:20:27 +01:00
dubiousjim
acf0958e94
Rename name/filename arguments to path (#4227)
There's a lot of variation in doc comments and internal code about
whether the first parameter to file system calls is `path` or `name` or
`filename`. For consistency, have made it always be `path`.
2020-03-06 11:29:23 -05:00
dubiousjim
6cd46fa3ef
Cleanup comments and internal variables (#4205) 2020-03-02 10:19:42 -05:00
Nayeem Rahman
14e7e1e3af
fix: Resolve makeTemp* paths from CWD (#4104) 2020-02-25 09:23:23 -05:00
Ryan Dahl
91b606aaae
Clean up how we use opIds (#4118) 2020-02-25 09:14:27 -05:00
Bartek Iwańczuk
4e1abb4f3a
refactor: use OpError instead of ErrBox for errors in ops (#4058)
To better reflect changes in error types in JS from #3662 this PR changes 
default error type used in ops from "ErrBox" to "OpError".

"OpError" is a type that can be sent over to JSON; it has all 
information needed to construct error in JavaScript. That
made "GetErrorKind" trait useless and so it was removed altogether.

To provide compatibility with previous use of "ErrBox" an implementation of
"From<ErrBox> for OpError" was added, however, it is an escape hatch and
ops implementors should strive to use "OpError" directly.
2020-02-23 14:51:29 -05:00
Kevin (Kun) "Kassimo" Qian
08dcf6bff7
feat: Deno.makeTempFile (#4024) 2020-02-18 14:45:59 -05:00
Ben Noordhuis
503d8bfef2
fix: skip non-UTF-8 dir entries in Deno.readDir() (#4004)
Example:

		$ python2 -c 'open("\x80\x7F", "w")'

		$ deno eval 'Deno.readDirSync(".")'
		thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', cli/ops/fs.rs:373:16
		note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
		fatal runtime error: failed to initiate panic, error 5
		Aborted (core dumped)

Before this commit they made deno panic, now they are silently skipped.
Not ideal but arguably better than panicking.

No test because what characters are and aren't allowed in filenames is
highly file system-dependent.

Closes #3950
2020-02-15 10:37:05 -05:00
Bartek Iwańczuk
cdba5ab6fc refactor: rename ThreadSafeState, use RefCell for mutable state (#3931)
* rename ThreadSafeState to State
* State stores InnerState wrapped in Rc and RefCell
2020-02-08 20:34:31 +01:00
Ryan Dahl
161cf7cdfd
refactor: Use Tokio's single-threaded runtime (#3844)
This change simplifies how we execute V8. Previously V8 Isolates jumped
around threads every time they were woken up. This was overly complex and
potentially hurting performance in a myriad ways. Now isolates run on
their own dedicated thread and never move.

- blocking_json spawns a thread and does not use a thread pool
- op_host_poll_worker and op_host_resume_worker are non-operational
- removes Worker::get_message and Worker::post_message
- ThreadSafeState::workers table contains WorkerChannel entries instead
  of actual Worker instances.
- MainWorker and CompilerWorker are no longer Futures.
- The multi-threaded version of deno_core_http_bench was removed.
- AyncOps no longer need to be Send + Sync

This PR is very large and several tests were disabled to speed
integration:
- installer_test_local_module_run
- installer_test_remote_module_run
- _015_duplicate_parallel_import
- _026_workers
2020-02-03 18:08:44 -05:00
Rafael Vargas
55063dd8e8
fix: Deno.remove() to properly remove dangling symlinks (#3860)
For some reason, the unit tests for Deno.remove() were not being imported to 
unit_tests.ts and, consequently, not being executed. Thus, I imported them, 
refactored some existent ones and wrote new ones for the symlink removal case.

Since the creation of a symlink is not implemented for Windows yet, assertions
that consider this state were added when the tests are executed in this OS.
2020-02-03 08:20:15 -05:00
EnokMan
1c6c6c6d7f
Deno.makeTempDir() check permissions (#3810) 2020-01-29 23:21:41 -05:00
Ryan Dahl
5e32c5ea44
s/PinnedBuf/ZeroCopyBuf (#3782) 2020-01-24 15:10:49 -05:00
Nayeem Rahman
7f80f9db3f refactor: Improve path handling in permission checks (#3714) 2020-01-20 09:45:44 -05:00
Kevin (Kun) "Kassimo" Qian
91757f63fd feat(fs): add more unix-only fields to FileInfo (#3680) 2020-01-16 09:46:32 -05:00
Ry Dahl
29df272133
error on warnings (#3612) 2020-01-06 11:38:56 -05:00
Ry Dahl
76e44ddfd0
Rename crates: 'deno' to 'deno_core' and 'deno_cli' to 'deno' (#3600) 2020-01-05 11:56:18 -05:00
Ry Dahl
bfab4ed0df
Happy new year! (#3578) 2020-01-02 15:13:47 -05:00
木杉
537c6b3ed9 fix realpath behavior in windows (#3425) 2019-12-01 11:23:35 -08:00
Kevin (Kun) "Kassimo" Qian
f88dc4e197 Add Deno.realpath (#3404) 2019-11-26 00:40:57 -08:00
Ryan Dahl
97d8498d46
Add init methods for each op module (#3087) 2019-10-11 11:41:54 -07:00
Bartek Iwańczuk
a6f6209f52 port fs ops to JSON (#2812) 2019-08-26 10:18:42 -04:00
Ryan Dahl
bc467b265f
introduce JSON serialization for ops (#2799)
Converts env(), exit(), execPath(), utime() and utimeSync() to use JSON
instead of flatbuffers.
2019-08-22 22:30:14 -07:00
Ryan Dahl
bdc97b3976
Organize dispatch a bit (#2796)
Just some clean up reorganization around flatbuffer/minimal dispatch
code. This is prep for adding a JSON dispatcher.
2019-08-21 20:42:48 -04:00
Bartek Iwańczuk
e6c349af9f split up ops.rs (#2753)
Note cli/dispatch_minimal.rs ops are not yet included in cli/ops.

This is part of work towards #2730
2019-08-14 11:03:02 -04:00