1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-11-24 06:04:04 +03:00
This commit is contained in:
Eugene Pankov 2017-07-26 16:14:18 +02:00
parent feb4c5bcb6
commit 5045c4c82a

View File

@ -1,6 +1,6 @@
import { Injectable } from '@angular/core'
import * as AsyncLock from 'async-lock'
import { Observable, Subject } from 'rxjs'
import { ConnectableObservable, Subject } from 'rxjs'
import * as childProcess from 'child_process'
import { SessionOptions, SessionPersistenceProvider } from './api'
@ -37,7 +37,7 @@ export class TMuxCommandProcess {
private line$ = new Subject<string>()
private message$ = new Subject<string>()
private block$ = new Subject<TMuxBlock>()
private response$: Observable<TMuxBlock>
private response$: ConnectableObservable<TMuxBlock>
private lock = new AsyncLock({ timeout: 1000 })
constructor () {
@ -86,16 +86,13 @@ export class TMuxCommandProcess {
}
})
this.response$ = this.block$.skip(1).share()
this.response$ = this.block$.skip(1).publish()
this.response$.connect()
this.block$.subscribe(block => {
console.debug('[tmux] block:', block)
})
this.response$.subscribe(response => {
console.debug('[tmux] response:', response)
})
this.message$.subscribe(message => {
console.debug('[tmux] message:', message)
})
@ -106,8 +103,6 @@ export class TMuxCommandProcess {
let p = this.response$.take(1).toPromise()
console.debug('[tmux] command:', command)
this.process.stdin.write(command + '\n')
p.then(x => console.log('promise then', x))
p.catch(x => console.log('promise catch', x))
return p
}).then(response => {
if (response.error) {