Commit 3dd02801 authored by aniket-engg's avatar aniket-engg Committed by Aniket

do not compile in read only mode

parent ed3abb38
...@@ -9,7 +9,6 @@ export class HardhatClient extends PluginClient { ...@@ -9,7 +9,6 @@ export class HardhatClient extends PluginClient {
constructor (private readOnly = false) { constructor (private readOnly = false) {
super() super()
console.log('this is HardhatClient constructor')
this.methods = ['compile'] this.methods = ['compile']
} }
...@@ -22,12 +21,13 @@ export class HardhatClient extends PluginClient { ...@@ -22,12 +21,13 @@ export class HardhatClient extends PluginClient {
} }
compile (configPath: string) { compile (configPath: string) {
const cmd = `npx hardhat compile --config ${configPath}`
const options = { cwd: this.currentSharedFolder, shell: true }
const child = spawn(cmd, options)
let result = ''
let error = ''
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'))
const cmd = `npx hardhat compile --config ${configPath}`
const options = { cwd: this.currentSharedFolder, shell: true }
const child = spawn(cmd, options)
let result = ''
let error = ''
child.stdout.on('data', (data) => { child.stdout.on('data', (data) => {
console.log('data in compile in HardhatClient', data) console.log('data in compile in HardhatClient', data)
result += data.toString() result += data.toString()
......
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