Skip to content

Commit

Permalink
have to swap out the slashes so that the dirname command returns a us…
Browse files Browse the repository at this point in the history
…able path, this is primarily for msysgit bash support
  • Loading branch information
copenhas committed Oct 28, 2013
1 parent 250b351 commit 8bee9f6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function writeShim_ (from, to, prog, args, cb) {

if (shLongProg) {
sh = sh
+ "basedir=`dirname \"$0\"`\n"
+ "basedir=$(dirname \"$(echo \"$0\" | sed -e 's,\\\\,/,g')\")\n"
+ "\n"
+ "case `uname` in\n"
+ " *CYGWIN*) basedir=`cygpath -w \"$basedir\"`;;\n"
Expand Down
8 changes: 4 additions & 4 deletions test/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test('env shebang', function (t) {

t.equal(fs.readFileSync(to, 'utf8'),
"#!/bin/sh"+
"\nbasedir=`dirname \"$0\"`"+
"\nbasedir=$(dirname \"$(echo \"$0\" | sed -e 's,\\\\,/,g')\")"+
"\n"+
"\ncase `uname` in"+
"\n *CYGWIN*) basedir=`cygpath -w \"$basedir\"`;;"+
Expand Down Expand Up @@ -67,7 +67,7 @@ test('env shebang with args', function (t) {

t.equal(fs.readFileSync(to, 'utf8'),
"#!/bin/sh"+
"\nbasedir=`dirname \"$0\"`"+
"\nbasedir=$(dirname \"$(echo \"$0\" | sed -e 's,\\\\,/,g')\")"+
"\n"+
"\ncase `uname` in"+
"\n *CYGWIN*) basedir=`cygpath -w \"$basedir\"`;;"+
Expand Down Expand Up @@ -103,7 +103,7 @@ test('explicit shebang', function (t) {

t.equal(fs.readFileSync(to, 'utf8'),
"#!/bin/sh" +
"\nbasedir=`dirname \"$0\"`" +
"\nbasedir=$(dirname \"$(echo \"$0\" | sed -e 's,\\\\,/,g')\")" +
"\n" +
"\ncase `uname` in" +
"\n *CYGWIN*) basedir=`cygpath -w \"$basedir\"`;;" +
Expand Down Expand Up @@ -140,7 +140,7 @@ test('explicit shebang with args', function (t) {

t.equal(fs.readFileSync(to, 'utf8'),
"#!/bin/sh" +
"\nbasedir=`dirname \"$0\"`" +
"\nbasedir=$(dirname \"$(echo \"$0\" | sed -e 's,\\\\,/,g')\")" +
"\n" +
"\ncase `uname` in" +
"\n *CYGWIN*) basedir=`cygpath -w \"$basedir\"`;;" +
Expand Down

0 comments on commit 8bee9f6

Please sign in to comment.