Get boostrap stuff forking
They don't run yet but seem to be forking correctly now.
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import * as events from "events";
|
||||
import * as stream from "stream";
|
||||
import { SendableConnection } from "../common/connection";
|
||||
import { ReadWriteConnection } from "../common/connection";
|
||||
import { ShutdownSessionMessage, ClientMessage, WriteToSessionMessage, ResizeSessionTTYMessage, TTYDimensions as ProtoTTYDimensions, ConnectionOutputMessage, ConnectionCloseMessage } from "../proto";
|
||||
|
||||
export interface TTYDimensions {
|
||||
@ -40,11 +40,14 @@ export class ServerProcess extends events.EventEmitter implements ChildProcess {
|
||||
private _killed: boolean = false;
|
||||
|
||||
public constructor(
|
||||
private readonly connection: SendableConnection,
|
||||
private readonly connection: ReadWriteConnection,
|
||||
private readonly id: number,
|
||||
private readonly hasTty: boolean = false,
|
||||
) {
|
||||
super();
|
||||
this.connection.onMessage((message) => {
|
||||
this.emit("message", message);
|
||||
});
|
||||
|
||||
if (!this.hasTty) {
|
||||
delete this.resize;
|
||||
@ -131,7 +134,7 @@ export class ServerSocket extends events.EventEmitter implements Socket {
|
||||
private _connecting: boolean = true;
|
||||
|
||||
public constructor(
|
||||
private readonly connection: SendableConnection,
|
||||
private readonly connection: ReadWriteConnection,
|
||||
private readonly id: number,
|
||||
connectCallback?: () => void,
|
||||
) {
|
||||
|
@ -46,7 +46,7 @@ export class CP {
|
||||
|
||||
public fork = (modulePath: string, args?: ReadonlyArray<string> | cp.ForkOptions, options?: cp.ForkOptions): cp.ChildProcess => {
|
||||
//@ts-ignore
|
||||
return this.client.fork(modulePath, args, options);
|
||||
return this.client.fork(options && options.env && options.env.AMD_ENTRYPOINT || modulePath, args, options);
|
||||
}
|
||||
|
||||
public spawn = (command: string, args?: ReadonlyArray<string> | cp.SpawnOptions, options?: cp.SpawnOptions): cp.ChildProcess => {
|
||||
|
@ -3,7 +3,7 @@ import * as net from "net";
|
||||
import * as nodePty from "node-pty";
|
||||
import * as stream from "stream";
|
||||
import { TextEncoder } from "text-encoding";
|
||||
import { NewSessionMessage, ServerMessage, SessionDoneMessage, SessionOutputMessage, ShutdownSessionMessage, IdentifySessionMessage, ClientMessage, NewConnectionMessage, ConnectionEstablishedMessage, NewConnectionFailureMessage, ConnectionCloseMessage, ConnectionOutputMessage } from "../proto";
|
||||
import { NewSessionMessage, ServerMessage, SessionDoneMessage, SessionOutputMessage, IdentifySessionMessage, NewConnectionMessage, ConnectionEstablishedMessage, NewConnectionFailureMessage, ConnectionCloseMessage, ConnectionOutputMessage } from "../proto";
|
||||
import { SendableConnection } from "../common/connection";
|
||||
import { ServerOptions } from "./server";
|
||||
|
||||
@ -16,7 +16,7 @@ export interface Process {
|
||||
killed?: boolean;
|
||||
|
||||
on(event: "data", cb: (data: string) => void): void;
|
||||
on(event: 'exit', listener: (exitCode: number, signal?: number) => void): void;
|
||||
on(event: "exit", listener: (exitCode: number, signal?: number) => void): void;
|
||||
write(data: string | Uint8Array): void;
|
||||
resize?(cols: number, rows: number): void;
|
||||
kill(signal?: string): void;
|
||||
@ -170,4 +170,4 @@ export const handleNewConnection = (connection: SendableConnection, newConnectio
|
||||
});
|
||||
|
||||
return socket;
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user