From 5045c4c82a7434fea1cb7198973d93e3ad914433 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Wed, 26 Jul 2017 16:14:18 +0200 Subject: [PATCH] wip --- terminus-terminal/src/tmux.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/terminus-terminal/src/tmux.ts b/terminus-terminal/src/tmux.ts index d5b18e91..0744e1af 100644 --- a/terminus-terminal/src/tmux.ts +++ b/terminus-terminal/src/tmux.ts @@ -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() private message$ = new Subject() private block$ = new Subject() - private response$: Observable + private response$: ConnectableObservable 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) {