Skip to content

Commit

Permalink
auto-connect to file-tree when socket opens & closes
Browse files Browse the repository at this point in the history
  • Loading branch information
surajhell88 committed Oct 26, 2017
1 parent 1e10b72 commit 2e59da9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/terminal.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ module.exports = class Terminal extends EventEmitter

@waitForSocket = new Promise (resolve, reject) =>
@socket.on 'open', =>
if atom.project and atom.project.remoteftp
atom.project.remoteftp.connectToStudentFTP()
@emit 'open'
resolve()

Expand All @@ -36,6 +38,8 @@ module.exports = class Terminal extends EventEmitter
@emit 'message', message

@socket.on 'close', =>
if atom.project and atom.project.remoteftp
atom.project.remoteftp.disconnectStudentFtp()
@emit 'close'

@socket.on 'error', (e) =>
Expand All @@ -50,8 +54,6 @@ module.exports = class Terminal extends EventEmitter
reset: ->
console.log('term:reset')
@socket.reset()
if atom.project and atom.project.remoteftp
atom.project.remoteftp.connectToStudentFTP()

send: (msg) ->
if @waitForSocket
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"utf8": "2.1.1"
},
"packageDependencies": {
"greyatom-tree-view": "1.3.10",
"greyatom-tree-view": "1.3.11",
"tablr": "1.8.3"
},
"configSchema": {
Expand Down

0 comments on commit 2e59da9

Please sign in to comment.