mbostock / gistup

Create a gist from terminal, then use git to update it.
Other
488 stars 41 forks source link

Error on initialization #3

Closed konklone closed 10 years ago

konklone commented 10 years ago

Maybe it's cause I'm on Ubuntu, not sure how this stuff operates on OS X:

Press any key to open GitHub… 
/usr/local/lib/node_modules/gistup/bin/gistup:63
      if (error) throw error;
                       ^
Error: Command failed: Couldn't get a file descriptor referring to the console

at ChildProcess.exithandler (child_process.js:637:15)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:735:16)
    at Socket.<anonymous> (child_process.js:948:11)
    at Socket.EventEmitter.emit (events.js:95:17)
    at Pipe.close (net.js:466:12)

One workaround would be to allow an auth token to be given over the command line, as an option.

mbostock commented 10 years ago

Yeah. That error means it wasn’t able to open your web browser using the open command. For example, on Mac OS X, you can say:

open 'http://example.com'

And it will open that URL in your web browser of choice. What’s the equivalent in Ubuntu?

A simple workaround is to create your ~/.gistup.json file manually. It should look like this:

{
  "token": "XXXXXXXXXXXXXXXXXXXXXX"
}

Where XXXXXXXXXXXXXXXXXXXXXX is your access token.

mbostock commented 10 years ago

Added a simple fallback in 0.0.4. Thanks for the report!

konklone commented 10 years ago

Oh, nice!

Also, I poked around, looks like on Ubuntu it's xdg-open. Annoyingly though, open is available at /bin/open but it doesn't work. open will return a non-0 response code though, so you could do:

open [url] || xdg-open [url]

And that should execute xdg-open only if open fails. It will still print out the "Couldn't get a file descriptor referring to the console" error, though.

smnorris commented 10 years ago

I get this on OSX 10.9:

Press any key to open GitHub…
/usr/local/lib/node_modules/gistup/lib/gistup/get-settings.js:38
        child.exec(open + " 'https://github.com/settings/tokens/new'", functio
                   ^
ReferenceError: open is not defined
    at ReadStream.<anonymous> (/usr/local/lib/node_modules/gistup/lib/gistup/get-settings.js:38:20)
    at ReadStream.g (events.js:180:16)
    at ReadStream.EventEmitter.emit (events.js:95:17)
    at ReadStream.<anonymous> (_stream_readable.js:746:14)
    at ReadStream.EventEmitter.emit (events.js:92:17)
    at emitReadable_ (_stream_readable.js:408:10)
    at emitReadable (_stream_readable.js:404:5)
    at readableAddChunk (_stream_readable.js:165:9)
    at ReadStream.Readable.push (_stream_readable.js:127:10)
    at TTY.onread (net.js:528:21)

Odd, as open works fine from command line.

$ which open
/usr/bin/open
mbostock commented 10 years ago

Sorry, I must have just broken this. Looking.

mbostock commented 10 years ago

Fixed in 0.1.1.

smnorris commented 10 years ago

Thanks! Once I had ~/.gistup.json and my SSH keys generated, gistup opened the browser with no problems.

mbostock commented 10 years ago

Yep the bug was only on initialization.