pull/638/head
yann300 4 years ago
parent a789fa7f9a
commit 7d1fe50ef8
  1. 2
      apps/remix-ide/src/app/files/remixd-handle.js
  2. 6
      apps/remix-ide/src/app/panels/terminal.js
  3. 36
      libs/remixd/src/services/gitClient.ts

@ -84,7 +84,7 @@ export class RemixdHandle extends WebsocketPlugin {
}
}, 3000)
this.locahostProvider.init(_ => this.fileSystemExplorer.ensureRoot())
this.call('manager', 'activatePlugin', 'git')
this.call('manager', 'activatePlugin', 'git')
}
}
if (this.locahostProvider.isConnected()) {

@ -103,7 +103,7 @@ class Terminal extends Plugin {
})
this.on('scriptRunner', 'error', (msg) => {
this.commands.error.apply(this.commands, msg.data)
})
})
}
onDeactivation () {
@ -749,9 +749,9 @@ class Terminal extends Plugin {
try {
let result
if (script.trim().startsWith('git')) {
result = await this.call('git', 'execute', script)
result = await this.call('git', 'execute', script)
} else {
result = await this.call('scriptRunner', 'execute', script)
result = await this.call('scriptRunner', 'execute', script)
}
if (result) self.commands.html(yo`<pre>${result}</pre>`)
done()

@ -17,24 +17,24 @@ export class GitClient extends PluginClient {
this.readOnly = readOnly
}
execute (cmd: string) {
assertCommand(cmd)
const options = { cwd: this.currentSharedFolder, shell: true }
const child = spawn(cmd, options)
let result = ''
let error = ''
return new Promise((resolve, reject) => {
child.stdout.on('data', (data) => {
result += data.toString()
})
child.stderr.on('data', (err) => {
error += err.toString()
})
child.on('close', () => {
if (error) reject(error)
else resolve(result)
})
})
execute (cmd: string) {
assertCommand(cmd)
const options = { cwd: this.currentSharedFolder, shell: true }
const child = spawn(cmd, options)
let result = ''
let error = ''
return new Promise((resolve, reject) => {
child.stdout.on('data', (data) => {
result += data.toString()
})
child.stderr.on('data', (err) => {
error += err.toString()
})
child.on('close', () => {
if (error) reject(error)
else resolve(result)
})
})
}
}

Loading…
Cancel
Save