diff options
Diffstat (limited to 'cli/tools/jupyter/mod.rs')
-rw-r--r-- | cli/tools/jupyter/mod.rs | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/cli/tools/jupyter/mod.rs b/cli/tools/jupyter/mod.rs index da1c4bc4d..a4d0bb27d 100644 --- a/cli/tools/jupyter/mod.rs +++ b/cli/tools/jupyter/mod.rs @@ -3,7 +3,6 @@ use crate::args::Flags; use crate::args::JupyterFlags; use crate::ops; -use crate::tools::jupyter::server::StdioMsg; use crate::tools::repl; use crate::tools::test::create_single_test_event_channel; use crate::tools::test::reporters::PrettyTestReporter; @@ -15,7 +14,6 @@ use deno_core::error::generic_error; use deno_core::error::AnyError; use deno_core::located_script_name; use deno_core::resolve_url_or_path; -use deno_core::serde::Deserialize; use deno_core::serde_json; use deno_core::url::Url; use deno_runtime::deno_io::Stdio; @@ -24,11 +22,13 @@ use deno_runtime::permissions::Permissions; use deno_runtime::permissions::PermissionsContainer; use deno_runtime::WorkerExecutionMode; use deno_terminal::colors; + +use runtimelib::jupyter::ConnectionInfo; +use runtimelib::messaging::StreamContent; use tokio::sync::mpsc; use tokio::sync::mpsc::UnboundedSender; mod install; -pub mod jupyter_msg; pub mod server; pub async fn kernel( @@ -73,7 +73,7 @@ pub async fn kernel( std::fs::read_to_string(&connection_filepath).with_context(|| { format!("Couldn't read connection file: {:?}", connection_filepath) })?; - let spec: ConnectionSpec = + let spec: ConnectionInfo = serde_json::from_str(&conn_file).with_context(|| { format!( "Connection file is not a valid JSON: {:?}", @@ -119,12 +119,14 @@ pub async fn kernel( test_event_receiver, ) .await?; - struct TestWriter(UnboundedSender<StdioMsg>); + struct TestWriter(UnboundedSender<StreamContent>); impl std::io::Write for TestWriter { fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> { self .0 - .send(StdioMsg::Stdout(String::from_utf8_lossy(buf).into_owned())) + .send(StreamContent::stdout( + String::from_utf8_lossy(buf).into_owned(), + )) .ok(); Ok(buf.len()) } @@ -150,15 +152,3 @@ pub async fn kernel( Ok(()) } - -#[derive(Debug, Deserialize)] -pub struct ConnectionSpec { - ip: String, - transport: String, - control_port: u32, - shell_port: u32, - stdin_port: u32, - hb_port: u32, - iopub_port: u32, - key: String, -} |