Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LSOpenURLsWithRole() errors when in a tmux session

LSOpenURLsWithRole() failed with error -600 for the URL http://localhost:9000/.

This is the error I get when I try to launch my SimpleHTTPServer while in a tmux session. I'm a front-end web developer and I spend most of my time working with a SimpleHTTPServer, rather than Apache. The issue is that it errors out at the open command, because I have the habit of opening files and directories from the terminal directly (open dirname/, or open .) , and when i use this in tmux it gives me the same error. I want to mention that I'm on a Macbook Air, running OSX 10.9 Mavericks.

This is the code of the function I use in my terminal to start the server:

# Start an HTTP server from a directory, optionally specifying the port
function server() {
    local port="${1:-8000}"
    open "http://localhost:${port}/"
    # Set the default Content-Type to `text/plain` instead of `application/octet-stream`
    # And serve everything as UTF-8 (although not technically correct, this doesn’t break anything for binary files)
    python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\nmap[""] = "text/plain";\nfor key, value in map.items():\n\tmap[key] = value + ";charset=UTF-8";\nSimpleHTTPServer.test();' "$port" 
}

Edit

The issue doesn't appear anymore so I have 3 possible solutions for this:

Highly unlikely:

  • changing from Python3 to Python 2.7.5 (OS X Default)

Most likely:

  • Apple released an update to Mavericks that fixes this issue
  • installing Command-Line tools in order to use Homebrew to build & install the latest version of VIM
like image 409
Adrian Oprea Avatar asked Nov 01 '22 11:11

Adrian Oprea


1 Answers

Not sure if this is the same case for you, since you mentioned you restarted a few times ...

However for me, I noticed that I had stray 2 tmux sessions after an iterm failure, which I had forgotten about. They were running a bunch of services started by grunt, so i'm assuming that one of these services was conflicting when trying to start again. Killing them made the bug not occur anymore and I was able to run my node app in tmux.

like image 103
Cosmin Avatar answered Nov 15 '22 04:11

Cosmin