File tree Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ export class TestSwiftProcess implements SwiftProcess {
3838 number | void
3939 > ( ) ;
4040
41+ isSpawned : boolean = false ;
4142 private error ?: Error ;
4243
4344 constructor (
@@ -50,18 +51,28 @@ export class TestSwiftProcess implements SwiftProcess {
5051 }
5152
5253 spawn ( ) : void {
54+ this . isSpawned = true ;
5355 if ( this . error ) {
5456 this . errorEmitter . fire ( this . error ) ;
5557 } else {
5658 this . spawnEmitter . fire ( ) ;
5759 }
5860 }
5961
60- write ( line : string ) : void {
61- this . writeEmitter . fire ( `${ line } \n` ) ;
62+ write ( line : string , delimiter : string = "\n" ) : void {
63+ const output = `${ line } ${ delimiter } ` ;
64+ if ( ! this . isSpawned ) {
65+ this . onDidSpawn ( ( ) => this . writeEmitter . fire ( output ) ) ;
66+ return ;
67+ }
68+ this . writeEmitter . fire ( output ) ;
6269 }
6370
6471 close ( exitCode : number ) : void {
72+ if ( ! this . isSpawned ) {
73+ this . onDidSpawn ( ( ) => this . closeEmitter . fire ( exitCode ) ) ;
74+ return ;
75+ }
6576 this . closeEmitter . fire ( exitCode ) ;
6677 }
6778
@@ -76,12 +87,12 @@ export class TestSwiftProcess implements SwiftProcess {
7687
7788 // eslint-disable-next-line @typescript-eslint/no-unused-vars
7889 handleInput ( input : string ) : void {
79- throw new Error ( "Method not implemented." ) ;
90+ // Do nothing
8091 }
8192
8293 // eslint-disable-next-line @typescript-eslint/no-unused-vars
8394 setDimensions ( dimensions : vscode . TerminalDimensions ) : void {
84- throw new Error ( "Method not implemented." ) ;
95+ // Do nothing
8596 }
8697}
8798
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ export async function executeTaskAndWaitForResult(
4646}
4747
4848/**
49- * Wait for the writeable ficture to write some output
49+ * Wait for the writeable fixture to write some output
5050 *
5151 * @param fixture {@link SwiftTaskFixture } or {@link SwiftTask }
5252 * @returns The string that was written
@@ -61,7 +61,7 @@ export async function waitForWrite(fixture: { onDidWrite: vscode.Event<string> }
6161}
6262
6363/**
64- * Wait for the writeable ficture to write some output
64+ * Wait for the writeable fixture to write some output
6565 *
6666 * @param fixture {@link SwiftTaskFixture } or {@link SwiftTask }
6767 * @returns The string that was written
You can’t perform that action at this time.
0 commit comments