Skip to content

Commit

Permalink
fix: address todo comments
Browse files Browse the repository at this point in the history
  • Loading branch information
CompeyDev committed Jun 10, 2024
1 parent 70583c6 commit a30380c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 34 deletions.
13 changes: 2 additions & 11 deletions crates/lune-std-process/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,17 +224,14 @@ 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",
ChildProcessReader(
stdout_rx
.await
.expect("Stdout sender unexpectedly dropped")
.ok_or(LuaError::runtime(
"Cannot read from stdout when it is not piped",
))?,
.unwrap(),
),
)?
.with_value(
Expand All @@ -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(
Expand Down Expand Up @@ -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())
Expand Down
22 changes: 0 additions & 22 deletions test.lua

This file was deleted.

2 changes: 1 addition & 1 deletion tests/process/spawn/non_blocking.luau
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit a30380c

Please sign in to comment.