Skip to content

Commit

Permalink
Ugly workaround with st-util issue on Windows
Browse files Browse the repository at this point in the history
- For some reason we cannot caputre the output of st-util on windows - so we cannot detect succesful initialization on Windows.
- As a work around for the time being it will automatically resolve the init process after half a second, assuming the server launched correctly and is listening.
  • Loading branch information
Marus committed Feb 9, 2018
1 parent 7c2604d commit 12d595a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/backend/server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as ChildProcess from 'child_process';
import * as os from 'os';
import { EventEmitter } from 'events';
import * as portastic from 'portastic';
import { setTimeout } from 'timers';

export class GDBServer extends EventEmitter {
Expand All @@ -25,6 +25,18 @@ export class GDBServer extends EventEmitter {
this.process.stderr.on('data', this.onStderr.bind(this));
this.process.on('exit', this.onExit.bind(this));
this.process.on('error', this.onError.bind(this));

if(this.application.indexOf('st-util') !== -1 && os.platform() == 'win32') {
// For some reason we are not able to capture the st-util output on Windows
// For now assume that it will launch properly within 1/2 second and resolve the init
setTimeout(() => {
if (this.initResolve) {
this.initResolve(true);
this.initReject = null;
this.initResolve = null;
}
}, 500);
}
}
else { // For servers like BMP that are always running directly on the probe
resolve();
Expand Down

0 comments on commit 12d595a

Please sign in to comment.