Coder Social home page Coder Social logo

Comments (7)

bastimeyer avatar bastimeyer commented on May 22, 2024

Sounds strange...
Could you please check the value of the process.env.PATH, process.env.Path, process.env.path variables? Also see this line...
Start the application with --remote-debugging-port=8888 and open up http://localhost:8888 to do this.

The node-webkit version has changed since the v0.5.0 release from 0.10.1 to 0.10.4, so the issue might be in the old nw version.

from streamlink-twitch-gui.

Nevon avatar Nevon commented on May 22, 2024

I'm trying to get the value of process.env.PATH et. al. but requirejs minifies the file so that I can't get in to place a breakpoint (even after trying chrome's formatter), and even littering which.js with console.log statements doesn't seem to output anything. I must be something wrong. How are you supposed to work on this application? It seems kind of weird to have to create a build and run the node-webkit binary from inside the app bundle on the src directory, but I can't seem to find any obvious grunt tasks to launch it with debugging set up.

from streamlink-twitch-gui.

Nevon avatar Nevon commented on May 22, 2024

Alright, I installed the nodewebkit package globally and tried running the src directory with it. Lots of resources are broken and stuff, but I did get the value of PATHS:

0: "/usr/local/bin"
1: "/usr/bin"
2: "/bin"
3: "/usr/sbin"
4: "/sbin"
5: "/usr/local/opt/go/libexec/bin"
6: "/usr/bin"
7: "/bin"
8: "/usr/sbin"
9: "/sbin"
10: "/usr/local/bin"
11: "/usr/local/opt/go/libexec/bin"

As suspected, running the latest version from the repo does have the correct path. I'm trying to check the values from the installed version, but since I can't seem to get any breakpoints in there, it's proving to be challenging.

EDIT: Got the info by modifying the minified source in the installed app bundle.

0: "/usr/bin"
1: "/bin"
2: "/usr/sbin"
3: "/sbin"

I guess this might have been a bug with the old version of node-webkit, then.

from streamlink-twitch-gui.

bastimeyer avatar bastimeyer commented on May 22, 2024

I've just tested it with all v0.10.x node-webkit versions and it's still not working properly. 😞

Like you've mentioned, it's working after launching the application via the bash and using the open command, but it doesn't if you open it via the finder or dock. The value of process.env.PATH then is /usr/bin:/bin:/usr/sbin:/sbin instead of the expected /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin.

So is this really a node-webkit bug or is this intended behavior of OSX? (I don't use it, so I don't know...)
How can this be fixed? Simply adding the /usr/local/bin path could make it work, but this is a bit dirty.

from streamlink-twitch-gui.

Nevon avatar Nevon commented on May 22, 2024

It seems that apps launched through spotlight or the dock don't read environment variables from the normal places (.profile, .bash_profile, etc.), so $PATH is just set to whatever the default is. I guess it's intended (why, I don't know...), not a bug.

However, from what I've been able to gather from some quick googling, it seems you can set environment variables from within app bundles by declaring them in an Info.plist file. For node-webkit apps, that file should be in Contents/Info.plist, more info here. This answer on Stack Overflow mentions how to set the PATH variable.

The issue is that there's no way to read the path from any of the sane places, so I'm guessing the least intrusive way would be to create a list of common places where it could be installed and add that to a separate environment variable (LIVESTREAMER_TWITCH_GUI_PATH or something) and read that if available.

Now, I think you'd still want to read from the normal path as well, so maybe this line will have to change, since it only reads from the first available environment variable:

PATH = process.env.PATH || process.env.Path || process.env.path || "."

Maybe instead you could read from all of them (plus your own), filter out the duplicates and go from there?

I'd be willing to help you out, if I knew how the development workflow was set up, but I'm going to be very busy all week, so I'll likely not have any opportunity until next weekend. I'll be checking my notifications though, so I'll try to be around to test things or maybe try implementing something as soon as I have the time.

from streamlink-twitch-gui.

bastimeyer avatar bastimeyer commented on May 22, 2024

Thanks for offering your help, much appreciated!

I think the right way of fixing this issue would be changing the Info.plist and adding the needed LSEnvironment data. I don't want to change the code itself, because it's just an osx related issue and things don't need to be unnecessarily messy here.
It's a little bit sad that you can't read the user specific $PATH and prepend/append your path to it. But I think /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin should be good enough, since we're just looking for the livestreamer executable.

The problem I ran into so far is the way node-webkit-builder deals with a custom plist. You're able to define a custom one instead of generating one off the blank node-webkit app, but then you also need to provide all the other stuff. That's not what I want to do, I just want to add one (nested) key-value pair. So I guess I need to make another pull request over there.

from streamlink-twitch-gui.

bastimeyer avatar bastimeyer commented on May 22, 2024

I'm still waiting for a merge at nwutils/nw-builder#96...
My forked repositories will be used as build dependency until then.

from streamlink-twitch-gui.

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.