Coder Social home page Coder Social logo

Comments (10)

sigmaSd avatar sigmaSd commented on July 27, 2024

I can't reproduce on linux, I can run failure.ts many times without error

from dax.

Hexagon avatar Hexagon commented on July 27, 2024

Are you sure? The reproduction code fail on both a physical linux machine and codespaces for me.

Codespaces:

deno 1.34.1 (release, x86_64-unknown-linux-gnu)
v8 11.5.150.2
typescript 5.0.4

Local:

deno 1.33.4 (release, x86_64-unknown-linux-gnu)
v8 11.4.183.2
typescript 5.0.4

I made a repo out of it to keep it simple

https://github.com/Hexagon/dax-issue-146

from dax.

sigmaSd avatar sigmaSd commented on July 27, 2024

yeah the repo you linked also work

but funny thing I found, turns out deno lsp listen to port 8084 by default, so that might be the issue ? can you try using a different port ?

from dax.

sigmaSd avatar sigmaSd commented on July 27, 2024

or maybe no, let me pr some fixes to that repo, so we can test there more

from dax.

sigmaSd avatar sigmaSd commented on July 27, 2024

Can you try here https://github.com/sigmaSd/dax-issue-146 (this makes sure that dax have the latest version)
and can you kill -9 deno before starting just for sanity check

from dax.

Hexagon avatar Hexagon commented on July 27, 2024

Aaah, your version work fine. But it is because the server exit gracefully before dax tries to kill the process, if I add the server code to your version, it starts failing again (because the process is kept alive until it's killed by dax).


// Connections to the server will be yielded up as an async iterable.
for await (const conn of server) {
    // In order to not be blocking, we need to handle each connection individually
    // without awaiting the function
    serveHttp(conn);
  }
  
  async function serveHttp(conn: Deno.Conn) {
    // This "upgrades" a network connection into an HTTP connection.
    const httpConn = Deno.serveHttp(conn);
    // Each request sent over the HTTP connection will be yielded as an async
    // iterator from the HTTP connection.
    for await (const requestEvent of httpConn) {
      // The native HTTP server uses the web standard `Request` and `Response`
      // objects.
      const body = `Your user-agent is:\n\n${
        requestEvent.request.headers.get("user-agent") ?? "Unknown"
      }`;
      // The requestEvent's `.respondWith()` method is how we send the response
      // back to the client.
      requestEvent.respondWith(
        new Response(body, {
          status: 200,
        }),
      );
    }
  }

from dax.

sigmaSd avatar sigmaSd commented on July 27, 2024

I see, this is an issue with abortcontroller , here is a minimal example, I think you should close this issue and open one against deno repo

const control = new AbortController();
const child = new Deno.Command("deno", {
  // args: ["run","-A", "main.ts"], // works
  args: ["task", "prod"], // fails
  signal: control.signal,
}).spawn();

await new Promise((r) => setTimeout(r, 1000));
control.abort();

await child.status;

from dax.

sigmaSd avatar sigmaSd commented on July 27, 2024

or maybe its an issue with how deno task works

from dax.

sigmaSd avatar sigmaSd commented on July 27, 2024

actually here is the issue already denoland/deno#18445

from dax.

Hexagon avatar Hexagon commented on July 27, 2024

Ooh, cool. Thanks for checking it up 💯

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.