Git Product home page Git Product logo

Comments (11)

ipsBruno avatar ipsBruno commented on May 18, 2024

Same error here.

Aparrently, is problem of new-linejson

mappum/electron-eval#50

@mappum @feross

from webtorrent-hybrid.

mappum avatar mappum commented on May 18, 2024

It appears both occurrences have happened on Windows. Also, newline-json gives that error if the data begins with \n, so we just have to find where that newline is coming from.

from webtorrent-hybrid.

CodingButter avatar CodingButter commented on May 18, 2024

parse.js
commenting out lines 30 and 31 are a band-aid let me know if helps you

from webtorrent-hybrid.

ipsBruno avatar ipsBruno commented on May 18, 2024

I already try commenting out line. But don't still work here.

from webtorrent-hybrid.

mappum avatar mappum commented on May 18, 2024

That newline-json stream is receiving the stdout output of the Electron child process. So I think we will just have to ensure we consume the first byte (\n) of the stdout stream when using Windows (although it sucks that we have to).

from webtorrent-hybrid.

CodingButter avatar CodingButter commented on May 18, 2024

why is windows the problem?

from webtorrent-hybrid.

mappum avatar mappum commented on May 18, 2024

Can you guys test with electron-eval on this branch: https://github.com/mappum/electron-eval/tree/newline-fix?

from webtorrent-hybrid.

ipsBruno avatar ipsBruno commented on May 18, 2024

Nothing here.

I made all changes.

https://github.com/mappum/electron-eval/compare/newline-fix

And still show error here.

from webtorrent-hybrid.

ipsBruno avatar ipsBruno commented on May 18, 2024

I try with this:

   this.child.stdout.once('data', (data) => {
      // this hack fixes issues where some environments (namely Windows)
      // prepend a '\n' at the beginning of the stdout stream. This breaks
      // the JSON parser, so if the stream starts with '\n' we skip it
      while(true){
            var dec = data.toString().charCodeAt(0) ;

            if(dec != 13 && dec != 10) break;
            data = data.slice(1, data.length)
      }

      this.stdout.write(data)
      this.child.stdout.pipe(this.stdout)

    })

This aparently work here. Optimize my code, please.

Basicaly you need a left trim function in data array ..

Sorry my english. Thank you

from webtorrent-hybrid.

mappum avatar mappum commented on May 18, 2024

This should be fixed as of [email protected]. Can you guys reinstall and confirm that the issue is fixed?

from webtorrent-hybrid.

feross avatar feross commented on May 18, 2024

Just tested on Windows. This looks fixed to me. Thanks @mappum.

from webtorrent-hybrid.

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.