do not compile in read only mode

pull/1202/head
aniket-engg 4 years ago committed by Aniket
parent ed3abb38a8
commit 3dd02801d7
  1. 12
      libs/remixd/src/services/hardhatClient.ts

@ -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 {
} }
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()

Loading…
Cancel
Save