GithubHelp home page GithubHelp logo

Comments (8)

chjj avatar chjj commented on May 19, 2024

Sorry for the obvious question, but does /Users/lib/node_modules/tty.js/index.js exist? That's really strange.

from tty.js.

TooTallNate avatar TooTallNate commented on May 19, 2024

Negatory. Note that it's looking in /Users for some reason. When really it should be looking in /usr/local/lib/node_modules:

~ (master) ⚡ which tty.js
/usr/local/bin/tty.js

☮ ~ (master) ⚡ ls -l /usr/local/lib/node_modules/tty.js/
total 16K
-rw-r--r-- 1 nrajlich wheel 1.1K Feb  3 00:01 LICENSE
-rw-r--r-- 1 nrajlich wheel 3.2K Apr  4 03:18 README.md
drwxr-xr-x 3 nrajlich wheel  102 Apr  9 08:02 bin/
-rw-r--r-- 1 nrajlich wheel   42 Feb  2 09:48 index.js
drwxr-xr-x 4 nrajlich wheel  136 Apr  9 08:02 lib/
drwxr-xr-x 3 nrajlich wheel  102 Apr  9 08:02 man/
drwxr-xr-x 6 nrajlich wheel  204 Apr  9 08:02 node_modules/
-rw-r--r-- 1 nrajlich wheel 1.1K Apr  9 08:02 package.json
drwxr-xr-x 7 nrajlich wheel  238 Apr  9 08:02 static/

Try it yourself, I'm sure it'll happen for you too.

from tty.js.

TooTallNate avatar TooTallNate commented on May 19, 2024

Seems like you're not using dirname(1) properly. This patch makes things work for me:

diff --git a/bin/tty.js b/bin/tty.js
index d824a74..9f8f841 100755
--- a/bin/tty.js
+++ b/bin/tty.js
@@ -4,7 +4,9 @@ f=$0
 while test -L "$f"; do
   f=$(readlink "$f")
 done
-dir="$(dirname "$f")/.."
+dir=`dirname "$f"`
+dir=`dirname "$dir"`
+dir=`readlink -f "$dir"`

 node=$(which node 2>/dev/null)
 if test -z "$node"; then

from tty.js.

chjj avatar chjj commented on May 19, 2024

Oh, I think I figured out the problem. My readlink resolution doesn't take into account relative symlinks (I can't use readlink -f there because it's not portable), so if it hits a link that's relative, it won't be able to resolve the path correctly and end up giving you a weird one instead.

from tty.js.

lucaspiller avatar lucaspiller commented on May 19, 2024

@TooTallNate Unfortunately this doesn't work on Mac OS X as the included version of readlink doesn't support the -f flag. I'm not sure of a better solution, I came across this, but it doesn't seem great: http://serverfault.com/questions/40144/how-can-i-retrieve-the-absolute-filename-in-a-shell-script-on-mac-os-x

from tty.js.

TooTallNate avatar TooTallNate commented on May 19, 2024

@chjj If I were you I would just rewrite this startup script in node; would make things a lot simpler.

from tty.js.

chjj avatar chjj commented on May 19, 2024

@TooTallNate, I originally chose a bash script because it's easier to daemonize the process. I'll rewrite it in node though.

from tty.js.

chjj avatar chjj commented on May 19, 2024

Fixed for next release. The start script was rewritten in node.

from tty.js.

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.