Skip to content

Commit

Permalink
fix dangling file created at installation on linux/arm64
Browse files Browse the repository at this point in the history
fixes #114
  • Loading branch information
gilbsgilbs committed Aug 23, 2022
1 parent 8f19248 commit 6563b43
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ import bin from './index.js';

(async () => {
try {
// On linux platforms with non-intel architectures, bin-wrapper still
// downloads and tries to execute the x86_64 ELF. This results in the
// binary file being interpreted as a shell script, which creates a
// dangling file that can make npm or yarn crash at installation. This
// condition prevents this from happening.
//
// See https://github.com/imagemin/gifsicle-bin/issues/124#issuecomment-1222646680
if (process.platform === 'linux' && !['ia32', 'x64'].includes(process.arch)) {
throw Error(`Unsupported platform: ${process.platform}/${process.arch}.`);
}

await bin.run(['--version']);
console.log('optipng pre-build test passed successfully');
} catch (error) {
Expand Down

0 comments on commit 6563b43

Please sign in to comment.