diff --git a/crates/lune-std-process/src/lib.rs b/crates/lune-std-process/src/lib.rs index f9cb7b56..0a2d5b45 100644 --- a/crates/lune-std-process/src/lib.rs +++ b/crates/lune-std-process/src/lib.rs @@ -224,7 +224,6 @@ async fn process_spawn( .expect("ExitCode receiver was unexpectedly dropped"); }); - // TODO: Remove the lua errors since we no longer accept stdio options for spawn TableBuilder::new(lua)? .with_value( "stdout", @@ -232,9 +231,7 @@ async fn process_spawn( stdout_rx .await .expect("Stdout sender unexpectedly dropped") - .ok_or(LuaError::runtime( - "Cannot read from stdout when it is not piped", - ))?, + .unwrap(), ), )? .with_value( @@ -243,9 +240,7 @@ async fn process_spawn( stderr_rx .await .expect("Stderr sender unexpectedly dropped") - .ok_or(LuaError::runtime( - "Cannot read from stderr when it is not piped", - ))?, + .unwrap(), ), )? .with_value( @@ -284,10 +279,6 @@ async fn spawn_command( let stderr = options.stdio.stderr; let stdin = options.stdio.stdin.take(); - // TODO: Have an stdin_kind which the user can supply as piped or not - // TODO: Maybe even revamp the stdout/stderr kinds? User should only use - // piped when they are sure they want to read the stdout. Currently we default - // to piped let mut child = options .into_command(program, args) .stdin(Stdio::piped()) diff --git a/test.lua b/test.lua deleted file mode 100644 index 42a8621f..00000000 --- a/test.lua +++ /dev/null @@ -1,22 +0,0 @@ -local process = require("@lune/process") -local stdio = require("@lune/stdio") -local task = require("@lune/task") -local child = process.spawn("echo", { "lsp" }) -task.wait(1) - - -stdio.write(buffer.tostring(child.stdout:readToEnd())) -stdio.write(buffer.tostring(child.stdout:readToEnd())) -stdio.write(buffer.tostring(child.stdout:readToEnd())) - --- while true do --- child.stdin:write("hello world") --- local buf = child.stdout:read() - --- if buffer.len(buf) == 0 then --- break --- end - --- stdio.write(buffer.tostring(buf) .. "\n") --- -- stdio.write(buffer.tostring(child.stderr:read() .. child.stderr:read() .. child.stderr:read() .. child.stderr:read())) --- end \ No newline at end of file diff --git a/tests/process/spawn/non_blocking.luau b/tests/process/spawn/non_blocking.luau index 9b886c0f..39d87832 100644 --- a/tests/process/spawn/non_blocking.luau +++ b/tests/process/spawn/non_blocking.luau @@ -13,6 +13,6 @@ for _ = 1, SAMPLES do local delta = os.time() - start assert( delta <= 1, - `Spawning a child process should not block the main thread, process.spawn took {delta}s to return it should return immediately` + `Spawning a child process should not block the main thread, process.spawn took {delta}s to return when it should return immediately` ) end