Commit 5ed00420 authored by aniket-engg's avatar aniket-engg Committed by Aniket

logging for hardhat conmpilation

parent 2ead1c59
...@@ -22,17 +22,22 @@ export class HardhatClient extends PluginClient { ...@@ -22,17 +22,22 @@ export class HardhatClient extends PluginClient {
compile (configPath: string) { compile (configPath: string) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (this.readOnly) return reject(new Error('Cannot run Hardhat compilation in read-only mode')) if (this.readOnly) {
const errMsg = '[Hardhat Compilation]: Cannot compile in read-only mode'
console.log('\x1b[31m%s\x1b[0m', `${errMsg}`)
return reject(new Error(errMsg))
}
const cmd = `npx hardhat compile --config ${configPath}` const cmd = `npx hardhat compile --config ${configPath}`
const options = { cwd: this.currentSharedFolder, shell: true } const options = { cwd: this.currentSharedFolder, shell: true }
const child = spawn(cmd, options) const child = spawn(cmd, options)
let result = '' let result = ''
let error = '' let error = ''
child.stdout.on('data', (data) => { child.stdout.on('data', (data) => {
console.log('data in compile in HardhatClient', data) console.log('\x1b[32m%s\x1b[0m', `[Hardhat Compilation]: ${data.toString()}`)
result += data.toString() result += data.toString()
}) })
child.stderr.on('data', (err) => { child.stderr.on('data', (err) => {
console.log('\x1b[31m%s\x1b[0m', `[Hardhat Compilation]: ${err.toString()}`)
error += err.toString() error += err.toString()
}) })
child.on('close', () => { child.on('close', () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment