Coder Social home page Coder Social logo

Bug with `stdin`? about dax HOT 3 CLOSED

dsherret avatar dsherret commented on July 27, 2024
Bug with `stdin`?

from dax.

Comments (3)

dsherret avatar dsherret commented on July 27, 2024

Yeah, that sounds correct to me. Thanks!

By the way, right now the whole way pipes work in dax is not exactly the same as in a shell. In https://github.com/denoland/deno_task_shell for example, it's implemented using real operating system level pipes (using https://crates.io/crates/os_pipe), but there's no such primitive available in Deno (ex. no pipe on Linux or anonymous pipe on Windows). So for example, doing something like command1 && command2 and having both commands read from the provided stdin won't work. It might eventually be added to Deno, but for now we have this limitation.

from dax.

pocketken avatar pocketken commented on July 27, 2024

By the way, right now the whole way pipes work in dax is not exactly the same as in a shell. In https://github.com/denoland/deno_task_shell for example, it's implemented using real operating system level pipes (using https://crates.io/crates/os_pipe), but there's no such primitive available in Deno (ex. no pipe on Linux or anonymous pipe on Windows). So for example, doing something like command1 && command2 and having both commands read from the provided stdin won't work. It might eventually be added to Deno, but for now we have this limitation.

Yeah I gathered as much as soon as I started to look through the code for deno_task_shell and (briefly) gazed down the "threading in Web Assembly" rabbit hole...

from dax.

pocketken avatar pocketken commented on July 27, 2024

Might have introduced a leak, now that I think about it:

  } finally {
    completeController.abort();
    context.signal.removeEventListener("abort", abortListener);
    p.close();
    // pre-65d20b9: p.stdin?.close();
    p.stdout?.close();
    p.stderr?.close();
  }

  async function writeStdin(stdin: ShellPipeReader, p: Deno.Process, signal: AbortSignal) {
    if (typeof stdin === "string") {
      return;
    }
    await pipeReaderToWriter(stdin, p.stdin!, signal);
    p.stdin!.close();
  }

Previously p.stdin was always closed in the finally block. After this change if typeof stdin === "string", p.stdin doesn't get closed.

I'll throw together a follow-up PR.

from dax.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.