Skip to content

Commit

Permalink
GH-815: Removed terminal writeable stream.
Browse files Browse the repository at this point in the history
Also changed the info log level to debug in the process manager.

Signed-off-by: Akos Kitta <kittaakos@gmail.com>
  • Loading branch information
kittaakos committed Nov 27, 2017
1 parent 9558848 commit b5b9e0b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 22 deletions.
6 changes: 3 additions & 3 deletions packages/process/src/node/process-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ export class ProcessManager implements BackendApplicationContribution {
*/
protected unregister(process: Process): void {
const processLabel = this.getProcessLabel(process);
this.logger.info(`Unregistering process. ${processLabel}`);
this.logger.debug(`Unregistering process. ${processLabel}`);
if (!process.killed) {
this.logger.info(`Ensuring process termination. ${processLabel}`);
this.logger.debug(`Ensuring process termination. ${processLabel}`);
process.kill();
}
if (this.processes.delete(process.id)) {
this.deleteEmitter.fire(process.id);
this.logger.info(`The process was successfully unregistered. ${processLabel}`);
this.logger.debug(`The process was successfully unregistered. ${processLabel}`);
} else {
this.logger.warn(`This process was not registered or was already unregistered. ${processLabel}`);
}
Expand Down
1 change: 0 additions & 1 deletion packages/process/src/node/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export abstract class Process {
readonly exitEmitter: Emitter<IProcessExitEvent>;
readonly errorEmitter: Emitter<Error>;
abstract readonly pid: number;
abstract readonly input: stream.Writable;
abstract readonly output: stream.Readable;
protected _killed = false;

Expand Down
6 changes: 3 additions & 3 deletions packages/process/src/node/raw-process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { injectable, inject } from 'inversify';
import { ProcessManager } from './process-manager';
import { ILogger } from '@theia/core/lib/common';
import { Process, ProcessType } from './process';
import * as child_process from 'child_process';
import { ChildProcess, spawn } from 'child_process';
import * as stream from 'stream';

export const RawProcessOptions = Symbol("RawProcessOptions");
Expand All @@ -30,7 +30,7 @@ export class RawProcess extends Process {
readonly input: stream.Writable;
readonly output: stream.Readable;
readonly errorOutput: stream.Readable;
readonly process: child_process.ChildProcess;
readonly process: ChildProcess;

constructor(
@inject(RawProcessOptions) options: RawProcessOptions,
Expand All @@ -42,7 +42,7 @@ export class RawProcess extends Process {
+ ` with args : ${options.args}, `
+ ` options ${JSON.stringify(options.options)}`);

this.process = child_process.spawn(
this.process = spawn(
options.command,
options.args,
options.options);
Expand Down
15 changes: 0 additions & 15 deletions packages/process/src/node/terminal-process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,9 @@ class ReadableTerminalStream extends stream.Readable {

}

class WritableTerminalStream extends stream.Writable {

constructor(protected readonly terminal: ITerminal) {
super({
write: (chunk, encoding, next) => {
this.terminal.write(chunk.toString());
next();
}
});
}

}

@injectable()
export class TerminalProcess extends Process {

readonly input: stream.Writable;
readonly output: stream.Readable;
protected readonly terminal: ITerminal;

Expand All @@ -76,7 +62,6 @@ export class TerminalProcess extends Process {

this.terminal.on('exit', this.emitOnExit.bind(this));
this.output = new ReadableTerminalStream(this.terminal);
this.input = new WritableTerminalStream(this.terminal);
}

get pid() {
Expand Down

0 comments on commit b5b9e0b

Please sign in to comment.