Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Commit

Permalink
Use xdg-open on linux.
Browse files Browse the repository at this point in the history
Fixes #3 #14.
  • Loading branch information
mbostock committed Mar 23, 2014
1 parent 688643b commit bcfdb1e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bin/gistup
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ var argv = require("optimist").usage("Usage: \033[1mgistup\033[0m [options] -- [
})
.argv;

var open = process.platform === "linux" ? "xdg-open" : "open";

queue(1)
.defer(getSettings)
.defer(gitInit)
Expand Down Expand Up @@ -120,7 +122,7 @@ function getSettings(callback) {
process.stdin.setRawMode(true);
process.stdin.resume();
process.stdin.once("data", function() {
child.exec("open 'https://github.com/settings/tokens/new'", function(error) {
child.exec(open + " 'https://github.com/settings/tokens/new'", function(error) {
if (error) {
argv.open = false;
console.log("");
Expand Down Expand Up @@ -283,7 +285,7 @@ function gitPush(callback) {

function openBrowser(id, callback) {
if (!argv.open) return void callback(null);
child.exec("open " + singlequote(argv.open) + id, function(error, stdout, stderr) {
child.exec(open + " " + singlequote(argv.open) + id, function(error, stdout, stderr) {
if (!error && stderr) process.stderr.write(stderr); // ignore errors
callback(null);
});
Expand Down

0 comments on commit bcfdb1e

Please sign in to comment.