Skip to content

Instantly share code, notes, and snippets.

@ry
Created December 11, 2018 17:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ry/01ed1055964fe5cba8c38839635a5b2d to your computer and use it in GitHub Desktop.
Save ry/01ed1055964fe5cba8c38839635a5b2d to your computer and use it in GitHub Desktop.
Example
From 054728be9340f9b42db3665a919de9ffe113420b Mon Sep 17 00:00:00 2001
From: Ryan Dahl <ry@tinyclouds.org>
Date: Tue, 11 Dec 2018 12:29:13 -0500
Subject: [PATCH] Demo tokio swallowing panics
Try this: deno.readFile("/")
It should crash but it does not.
---
src/ops.rs | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/ops.rs b/src/ops.rs
index 8e83887..01d74bb 100644
--- a/src/ops.rs
+++ b/src/ops.rs
@@ -761,10 +761,12 @@ fn op_read_file(
) -> Box<Op> {
assert_eq!(data.len(), 0);
let inner = base.inner_as_read_file().unwrap();
- let cmd_id = base.cmd_id();
+ let _cmd_id = base.cmd_id();
let filename = PathBuf::from(inner.filename().unwrap());
debug!("op_read_file {}", filename.display());
blocking(base.sync(), move || {
+ panic!("xxx")
+ /*
let vec = fs::read(&filename)?;
// Build the response message. memcpy data into inner.
// TODO(ry) zero-copy.
@@ -785,6 +787,7 @@ fn op_read_file(
..Default::default()
},
))
+ */
})
}
--
2.15.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment