Skip to content

Commit

Permalink
Fix regression with awk command (and any other symlinked commands) (#34)
Browse files Browse the repository at this point in the history
* Fix awk issue

* Fix symlink restore logic

* Bump version -> 0.3.8

* Run tests after package symlink/hardlink roundtrip

* Add regression test for git https

* Fix busted logic

* Update package.json / appveyor
  • Loading branch information
bryphe authored Nov 1, 2018
1 parent 17f17e5 commit 4d4d9f6
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
17 changes: 16 additions & 1 deletion __tests__/esy-bash-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,5 +165,20 @@ invocations.forEach((invocation) => {
expect(fs.existsSync(path.join(destDirectory, "test.txt"))).toBe(true);
});
});
})

describe("awk", () => {
it("can run awk", async () => {
const output = await esyBashRun(`awk --version`);
expect(output.status).toEqual(0);
});
});

describe("git", () => {
it("can run git w/ https", async () => {
const output = await esyBashRun(`git ls-remote https://github.com/yarnpkg/example-yarn-package.git`);
console.dir(output);
expect(output.status).toEqual(0);
});
});
});
});
6 changes: 6 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ build_script:
- cd ..
- npm run test
- npm run package-cygwin
# Package, and then run the tests again w/ our bundled artifacts
# This catches bugs with our symlink/hardlink restoration
# - npm pack
# - node postinstall.js
# - npm run test
# - rimraf *.tgz

test: off

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "esy-bash",
"version": "0.3.6",
"version": "0.3.9",
"description": "Cross-platform bash utilities - primed for Reason/OCaml",
"main": "index.js",
"bin": {
Expand Down
13 changes: 11 additions & 2 deletions scripts/consolidate-links.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,19 @@ const restoreLinks = () => {
const symlinks = allLinks.symlinks;
Object.keys(symlinks).forEach((key) => {
const link = path.join(cygwinFolder, key);
const orig = path.join(cygwinFolder, symlinks[key]);

let orig = symlinks[key];

// If the key points to an absolute path, use that.
// Otherwise, it's relative to the link, so append the path.
if (orig[0] !== '/' && orig[0] !== '\\') {
orig = path.dirname(link) + "/" + orig;
} else {
orig = path.join(cygwinFolder, orig);
}

if (!fs.existsSync(orig)) {
console.warn("Cannot find original path, skipping symlink: " + link);
console.warn("Cannot find original path: " + orig + ", skipping symlink: " + link);
return;
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-links.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const isSymlink = (filePath) => {
}

// HACK: Skip non-ssl and non-etc paths to speed this up...
if (filePath.indexOf("ssl") === -1 && filePath.indexOf("etc") === -1) {
if (filePath.indexOf("ssl") === -1 && filePath.indexOf("etc") === -1 && filePath.indexOf("bin") === -1) {
return false;
}

Expand Down

0 comments on commit 4d4d9f6

Please sign in to comment.