Skip to content

Commit

Permalink
Add timeout for better protection
Browse files Browse the repository at this point in the history
  • Loading branch information
tilk committed Jan 19, 2024
1 parent 956f443 commit b850fbd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,7 @@ export async function verilator_lint(filenames: string[], dirname?: string, opti
try {
const output: LintMessage[] = [];
const verilator_result: {stdout: string, stderr: string} = await promisify(child_process.exec)(
'verilator -lint-only -Wall -Wno-DECLFILENAME -Wno-UNOPT -Wno-UNOPTFLAT ' + filenames.map(shell_escape).join(' '),
'timeout -k10s 40s verilator -lint-only -Wall -Wno-DECLFILENAME -Wno-UNOPT -Wno-UNOPTFLAT ' + filenames.map(shell_escape).join(' '),
{maxBuffer: 1000000, cwd: dirname || null, timeout: options.timeout || 60000})
.catch(exc => exc);
for (const line of verilator_result.stderr.split('\n')) {
Expand Down Expand Up @@ -1246,7 +1246,7 @@ export async function process(filenames: string[], dirname?: string, options: Op
const tmpjson = await tmp.tmpName({ postfix: '.json' });
let obj = undefined;
const yosys_result: {stdout: string, stderr: string, killed?: boolean, code?: number} = await promisify(child_process.exec)(
'yosys -p "' + shell_escape_contents(filenames.map(process_filename).join('; ')) +
'timeout -k10s 40s yosys -p "' + shell_escape_contents(filenames.map(process_filename).join('; ')) +
'; hierarchy -auto-top; proc' + optimize_simp + fsmpass + '; memory -nomap; wreduce -memx' +
optimize + '" -o "' + tmpjson + '"',
{maxBuffer: 1000000, cwd: dirname || null, timeout: options.timeout || 60000})
Expand Down

0 comments on commit b850fbd

Please sign in to comment.