microsoft/vscode-react-native
Publicmirrored from https://github.com/microsoft/vscode-react-nativeAvailable
src/test/resources/simulators/childProcess.ts
46lines · modeblame
efebb488digeff10 years ago | 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT license. See LICENSE file in the project root for details. | |
| 3 | | |
| 4 | import * as stream from "stream"; | |
| 5 | import * as events from "events"; | |
| 6 | import * as child_process from "child_process"; | |
| 7 | | |
| 8 | class 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 */ | |
| 14 | export 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 | |
6d5c8798Nikita Matrosov9 years ago | 19 | public connected: boolean; |
81f88231Patricio Beltran9 years ago | 20 | public stdio: [stream.Writable, stream.Readable, stream.Readable]; // Not yet implemented |
efebb488digeff10 years ago | 21 | |
| 22 | public kill(signal?: string): void { | |
| 23 | this.notYetImplemented(); | |
| 24 | } | |
| 25 | | |
6d5c8798Nikita Matrosov9 years ago | 26 | public send(message: any, sendHandle?: any): boolean { |
efebb488digeff10 years ago | 27 | this.notYetImplemented(); |
6d5c8798Nikita Matrosov9 years ago | 28 | return false; |
efebb488digeff10 years ago | 29 | } |
| 30 | | |
| 31 | public disconnect(): void { | |
| 32 | this.notYetImplemented(); | |
| 33 | } | |
| 34 | | |
| 35 | public unref(): void { | |
| 36 | this.notYetImplemented(); | |
| 37 | } | |
| 38 | | |
6d5c8798Nikita Matrosov9 years ago | 39 | public ref(): void { |
| 40 | this.notYetImplemented(); | |
| 41 | } | |
| 42 | | |
efebb488digeff10 years ago | 43 | private notYetImplemented(): void { // We'll implement these methods if we ever need them |
| 44 | throw new Error("This method of class ChildProcess has not yet been implemented."); | |
| 45 | } | |
| 46 | } |