Skip to content

Commit 6563b43

Browse files
committed
fix dangling file created at installation on linux/arm64
fixes #114
1 parent 8f19248 commit 6563b43

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/install.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ import bin from './index.js';
55

66
(async () => {
77
try {
8+
// On linux platforms with non-intel architectures, bin-wrapper still
9+
// downloads and tries to execute the x86_64 ELF. This results in the
10+
// binary file being interpreted as a shell script, which creates a
11+
// dangling file that can make npm or yarn crash at installation. This
12+
// condition prevents this from happening.
13+
//
14+
// See https://github.com/imagemin/gifsicle-bin/issues/124#issuecomment-1222646680
15+
if (process.platform === 'linux' && !['ia32', 'x64'].includes(process.arch)) {
16+
throw Error(`Unsupported platform: ${process.platform}/${process.arch}.`);
17+
}
18+
819
await bin.run(['--version']);
920
console.log('optipng pre-build test passed successfully');
1021
} catch (error) {

0 commit comments

Comments
 (0)