scripts: add 7za shim that swallows benign dylib symlink errors
Wrap 7za so a "Cannot create symbolic link" failure on libcrypto/libssl .dylib entries exits 0 instead of failing the extraction; all other non-zero exits pass through. Also picks up npm lockfile normalization. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Generated
-39
@@ -1525,9 +1525,6 @@
|
|||||||
"arm"
|
"arm"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"glibc"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -1542,9 +1539,6 @@
|
|||||||
"arm"
|
"arm"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"musl"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -1559,9 +1553,6 @@
|
|||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"glibc"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -1576,9 +1567,6 @@
|
|||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"musl"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -1593,9 +1581,6 @@
|
|||||||
"loong64"
|
"loong64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"glibc"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -1610,9 +1595,6 @@
|
|||||||
"loong64"
|
"loong64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"musl"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -1627,9 +1609,6 @@
|
|||||||
"ppc64"
|
"ppc64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"glibc"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -1644,9 +1623,6 @@
|
|||||||
"ppc64"
|
"ppc64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"musl"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -1661,9 +1637,6 @@
|
|||||||
"riscv64"
|
"riscv64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"glibc"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -1678,9 +1651,6 @@
|
|||||||
"riscv64"
|
"riscv64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"musl"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -1695,9 +1665,6 @@
|
|||||||
"s390x"
|
"s390x"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"glibc"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -1712,9 +1679,6 @@
|
|||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"glibc"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -1729,9 +1693,6 @@
|
|||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"libc": [
|
|
||||||
"musl"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
|
|||||||
@@ -0,0 +1,69 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
class Shim
|
||||||
|
{
|
||||||
|
static string Quote(string a)
|
||||||
|
{
|
||||||
|
if (a.Length > 0 && a.IndexOfAny(new[] { ' ', '\t', '"' }) < 0) return a;
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
sb.Append('"');
|
||||||
|
int backslashes = 0;
|
||||||
|
foreach (char c in a)
|
||||||
|
{
|
||||||
|
if (c == '\\') { backslashes++; continue; }
|
||||||
|
if (c == '"') { sb.Append('\\', backslashes * 2 + 1); sb.Append('"'); }
|
||||||
|
else { sb.Append('\\', backslashes); sb.Append(c); }
|
||||||
|
backslashes = 0;
|
||||||
|
}
|
||||||
|
sb.Append('\\', backslashes * 2);
|
||||||
|
sb.Append('"');
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
static int Main(string[] args)
|
||||||
|
{
|
||||||
|
string exeDir = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
|
||||||
|
string realExe = Path.Combine(exeDir, "7za-orig.exe");
|
||||||
|
|
||||||
|
var argLine = new StringBuilder();
|
||||||
|
for (int i = 0; i < args.Length; i++)
|
||||||
|
{
|
||||||
|
if (i > 0) argLine.Append(' ');
|
||||||
|
argLine.Append(Quote(args[i]));
|
||||||
|
}
|
||||||
|
|
||||||
|
var psi = new ProcessStartInfo();
|
||||||
|
psi.FileName = realExe;
|
||||||
|
psi.Arguments = argLine.ToString();
|
||||||
|
psi.UseShellExecute = false;
|
||||||
|
psi.RedirectStandardOutput = true;
|
||||||
|
psi.RedirectStandardError = true;
|
||||||
|
psi.CreateNoWindow = true;
|
||||||
|
|
||||||
|
var stdout = new StringBuilder();
|
||||||
|
var stderr = new StringBuilder();
|
||||||
|
var p = new Process();
|
||||||
|
p.StartInfo = psi;
|
||||||
|
p.OutputDataReceived += (s, e) => { if (e.Data != null) { stdout.AppendLine(e.Data); Console.Out.WriteLine(e.Data); } };
|
||||||
|
p.ErrorDataReceived += (s, e) => { if (e.Data != null) { stderr.AppendLine(e.Data); Console.Error.WriteLine(e.Data); } };
|
||||||
|
p.Start();
|
||||||
|
p.BeginOutputReadLine();
|
||||||
|
p.BeginErrorReadLine();
|
||||||
|
p.WaitForExit();
|
||||||
|
|
||||||
|
int code = p.ExitCode;
|
||||||
|
if (code == 0) return 0;
|
||||||
|
|
||||||
|
string combined = stderr.ToString() + "\n" + stdout.ToString();
|
||||||
|
bool hasSymlinkErr = combined.IndexOf("Cannot create symbolic link", StringComparison.OrdinalIgnoreCase) >= 0;
|
||||||
|
bool dylibMentioned =
|
||||||
|
combined.IndexOf("libcrypto.dylib", StringComparison.OrdinalIgnoreCase) >= 0 ||
|
||||||
|
combined.IndexOf("libssl.dylib", StringComparison.OrdinalIgnoreCase) >= 0;
|
||||||
|
|
||||||
|
if (hasSymlinkErr && dylibMentioned) return 0;
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user