Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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