handle exec

pull/5399/head
ioedeveloper 4 months ago
parent a35ac0daf0
commit f20c2dfebe
  1. 2
      apps/circuit-compiler/src/app/services/circomPluginClient.ts
  2. 10
      apps/remixdesktop/src/tools/circom.ts

@ -163,6 +163,8 @@ export class CircomPluginClient extends PluginClient {
if (stdout) this.call('terminal', 'log', { type: 'log', value: stdout })
} catch (error) {
this.call('terminal', 'log', { type: 'error', value: error.message })
this.internalEvents.emit('circuit_compiling_errored', error)
this.emit('statusChanged', { key: 'errored', title: 'Compilation failed', type: 'error' })
return
}
// @ts-ignore

@ -101,7 +101,15 @@ export const circomCli = {
const installationPath = getInstallationPath(version)
const cmd = `${installationPath} ${filePath} ${Object.keys(options || {}).map((key) => options[key] ? `--${key} ${options[key]}` : `--${key}`).join(' ')}`
return await execAsync(cmd)
return new Promise((resolve, reject) => {
exec(cmd, (error, stdout, stderr) => {
if (error) {
reject(error)
} else {
resolve({ stdout, stderr })
}
})
})
}
}

Loading…
Cancel
Save