8000 Tools: Fallback to use wget on Linux if curl is not available · Pagghiu/SaneCppLibraries@4f1e003 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit 4f1e003

Browse files
committed
Tools: Fallback to use wget on Linux if curl is not available
1 parent e78489b commit 4f1e003

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

Tools/SC-package.h

+19-2
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,25 @@ struct CustomFunctions
126126
if (not fs.existsAndIsFile(localFile) or not checkFileMD5(localFile, localFileMD5))
127127
{
128128
Process process;
129-
SC_TRY(process.exec({"curl", "-L", "-o", localFile, remoteURL}));
130-
SC_TRY_MSG(process.getExitStatus() == 0, "Cannot download file");
129+
String output;
130+
Result res = process.exec({"curl", "-L", "-o", localFile, remoteURL}, output);
131+
if (res)
132+
{
133+
SC_TRY_MSG(process.getExitStatus() == 0, "Cannot download file");
134+
}
135+
Process process2;
136+
if (not res)
137+
{
138+
res = process2.exec({"wget", "-O", localFile, remoteURL}, output);
139+
if (res)
140+
{
141+
SC_TRY_MSG(process2.getExitStatus() == 0, "Cannot download file");
142+
}
143+
}
144+
if (not res)
145+
{
146+
return Result::Error("Cannot find neither curl nor wget");
147+
}
131148
SC_TRY(checkFileMD5(localFile, localFileMD5));
132149
}
133150
return Result(true);

0 commit comments

Comments
 (0)
0