nushell on your web browser
nushell wasm terminal
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

register console callback before we init_engine so we can see cmd messages from there

dawn 02326f7e 5d442771

+9 -13
+2 -5
src/cmd/source_file.rs
··· 1 - use std::sync::Arc; 2 - 3 1 use crate::{ 4 2 error::{CommandError, to_shell_err}, 5 - globals::{get_pwd, get_vfs, print_to_console, set_pwd}, 3 + globals::{get_pwd, print_to_console, set_pwd}, 6 4 }; 7 5 use nu_engine::{CallExt, get_eval_block_with_early_return}; 8 6 use nu_parser::parse; 9 7 use nu_protocol::{ 10 - Category, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value, 8 + Category, PipelineData, ShellError, Signature, SyntaxShape, Type, 11 9 engine::{Command, EngineState, Stack, StateWorkingSet}, 12 10 }; 13 11 ··· 77 75 let start_offset = working_set.next_span_start(); 78 76 let _ = working_set.add_file(filename.into(), contents.as_bytes()); 79 77 80 - // we dont need the block here just the delta 81 78 let block = parse(&mut working_set, Some(filename), contents.as_bytes(), false); 82 79 83 80 if let Some(err) = working_set.parse_errors.into_iter().next() {
+7 -8
www/src/worker.ts
··· 11 11 12 12 // Initialize WASM 13 13 await init(); 14 - try { 15 - await init_engine(); 16 - } catch (error) { 17 - console.error(error); 18 - } 19 14 20 - // Setup Callbacks to proxy messages back to Main Thread 21 15 register_console_callback((msg: string, isCmd: boolean) => { 22 16 self.postMessage({ type: "console", payload: { msg, isCmd } }); 23 17 }); ··· 26 20 self.postMessage({ type: "task_count", payload: count }); 27 21 }); 28 22 29 - // Handle messages from Main Thread 23 + try { 24 + await init_engine(); 25 + } catch (error) { 26 + console.error(error); 27 + } 28 + 30 29 self.onmessage = async (e) => { 31 30 const { id, type, payload } = e.data; 32 31 ··· 51 50 result = get_pwd_string(); 52 51 break; 53 52 default: 54 - throw new Error(`Unknown message type: ${type}`); 53 + throw new Error(`unknown message type: ${type}`); 55 54 } 56 55 self.postMessage({ id, type: `${type}_result`, payload: result }); 57 56 } catch (err) {