Fix loading within the CLI (#27)

* Fix loading within the CLI

* Remove app

* Remove promise handle

* Fix requested changes
This commit is contained in:
Kyle Carberry
2019-02-05 11:15:20 -06:00
parent a85af49c58
commit 797efe72fd
28 changed files with 477 additions and 105 deletions

View File

@@ -1,6 +1,5 @@
import * as cp from "child_process";
import * as net from "net";
import * as nodePty from "node-pty";
import * as stream from "stream";
import { TextEncoder } from "text-encoding";
import { Logger, logger, field } from "@coder/logger";
@@ -44,6 +43,7 @@ export const handleNewSession = (connection: SendableConnection, newSession: New
});
if (newSession.getTtyDimensions()) {
// Spawn with node-pty
const nodePty = require("node-pty") as typeof import("node-pty");
const ptyProc = nodePty.spawn(newSession.getCommand(), newSession.getArgsList(), {
cols: newSession.getTtyDimensions()!.getWidth(),
rows: newSession.getTtyDimensions()!.getHeight(),
@@ -56,7 +56,7 @@ export const handleNewSession = (connection: SendableConnection, newSession: New
processTitle = ptyProc.process;
const id = new IdentifySessionMessage();
id.setId(newSession.getId());
id.setTitle(processTitle);
id.setTitle(processTitle!);
const sm = new ServerMessage();
sm.setIdentifySession(id);
connection.send(sm.serializeBinary());