Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 020e0a9

Browse files
committed
Increase maxBuffer to 10MB when compiling using native compiler
1 parent 95408a9 commit 020e0a9

File tree

1 file changed

+14
-19
lines changed
  • packages/compile-solidity/compilerSupplier/loadingStrategies

1 file changed

+14
-19
lines changed

packages/compile-solidity/compilerSupplier/loadingStrategies/Native.js

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,26 @@
1-
const { execSync } = require("child_process");
2-
const LoadingStrategy = require("./LoadingStrategy");
3-
const VersionRange = require("./VersionRange");
1+
const { execSync } = require('child_process');
2+
const LoadingStrategy = require('./LoadingStrategy');
3+
const VersionRange = require('./VersionRange');
44

55
class Native extends LoadingStrategy {
6-
load() {
6+
load () {
77
const versionString = this.validateAndGetSolcVersion();
8-
const command = "solc --standard-json";
8+
const command = 'solc --standard-json';
9+
const maxBuffer = 1024 * 1024 * 10;
910

10-
try {
11-
return {
12-
compile: options => String(execSync(command, { input: options })),
13-
version: () => versionString
14-
};
15-
} catch (error) {
16-
if (error.message === "No matching version found") {
17-
throw this.errors("noVersion", versionString);
18-
}
19-
throw new Error(error);
20-
}
11+
return {
12+
compile: options =>
13+
String(execSync(command, { input: options, maxBuffer })),
14+
version: () => versionString
15+
};
2116
}
2217

23-
validateAndGetSolcVersion() {
18+
validateAndGetSolcVersion () {
2419
let version;
2520
try {
26-
version = execSync("solc --version");
21+
version = execSync('solc --version');
2722
} catch (error) {
28-
throw this.errors("noNative", null, error);
23+
throw this.errors('noNative', null, error);
2924
}
3025
return new VersionRange(this.config).normalizeSolcVersion(version);
3126
}

0 commit comments

Comments
 (0)