microsoft/vscode-react-native

Public

mirrored fromhttps://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
0.5.1

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

test/resources/simulators/childProcess.ts

47lines · modecode

1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT license. See LICENSE file in the project root for details.
3
4import * as stream from "stream";
5import * as events from "events";
6import * as child_process from "child_process";
7
8class Stream extends events.EventEmitter {
9 // The methods we get from events.EventEmitter seems to be enough for what we need
10}
11
12/* ChildProcess can emit events to simulate the behavior of a real child process from the
13 spawneer/caller point of view */
14export class ChildProcess extends events.EventEmitter implements child_process.ChildProcess {
15 public stdin: stream.Writable = <stream.Writable>new Stream();
16 public stdout: stream.Readable = <stream.Readable>new Stream();
17 public stderr: stream.Readable = <stream.Readable>new Stream();
18 public pid: number; // Not yet implemented
19 public connected: boolean;
20 public stdio: [stream.Writable, stream.Readable, stream.Readable]; // Not yet implemented
21 public killed: boolean;
22
23 public kill(signal?: string): void {
24 this.notYetImplemented();
25 }
26
27 public send(message: any, sendHandle?: any): boolean {
28 this.notYetImplemented();
29 return false;
30 }
31
32 public disconnect(): void {
33 this.notYetImplemented();
34 }
35
36 public unref(): void {
37 this.notYetImplemented();
38 }
39
40 public ref(): void {
41 this.notYetImplemented();
42 }
43
44 private notYetImplemented(): void { // We'll implement these methods if we ever need them
45 throw new Error("This method of class ChildProcess has not yet been implemented.");
46 }
47}