Skip to content

Commit 1e8e65c

Browse files
committed
Merge pull request #1699 from Microsoft/instrumenterFix
Change sys to ts.sys in instrumenter
2 parents 5bcb52f + ca9cd9a commit 1e8e65c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/harness/instrumenter.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ var fs: any = require('fs');
33
var path: any = require('path');
44

55
function instrumentForRecording(fn: string, tscPath: string) {
6-
instrument(tscPath, 'sys = Playback.wrapSystem(sys); sys.startRecord("' + fn + '");', 'sys.endRecord();');
6+
instrument(tscPath, 'ts.sys = Playback.wrapSystem(ts.sys); ts.sys.startRecord("' + fn + '");', 'ts.sys.endRecord();');
77
}
88

99
function instrumentForReplay(logFilename: string, tscPath: string) {
10-
instrument(tscPath, 'sys = Playback.wrapSystem(sys); sys.startReplay("' + logFilename + '");');
10+
instrument(tscPath, 'ts.sys = Playback.wrapSystem(ts.sys); ts.sys.startReplay("' + logFilename + '");');
1111
}
1212

1313
function instrument(tscPath: string, prepareCode: string, cleanupCode: string = '') {
@@ -27,8 +27,12 @@ function instrument(tscPath: string, prepareCode: string, cleanupCode: string =
2727
fs.readFile(path.resolve(path.dirname(tscPath) + '/loggedIO.js'), 'utf-8', (err: any, loggerContent: string) => {
2828
if (err) throw err;
2929

30-
var invocationLine = 'ts.executeCommandLine(sys.args);';
30+
var invocationLine = 'ts.executeCommandLine(ts.sys.args);';
3131
var index1 = tscContent.indexOf(invocationLine);
32+
if (index1 < 0) {
33+
throw new Error("Could not find " + invocationLine);
34+
}
35+
3236
var index2 = index1 + invocationLine.length;
3337
var newContent = tscContent.substr(0, index1) + loggerContent + prepareCode + invocationLine + cleanupCode + tscContent.substr(index2) + '\r\n';
3438
fs.writeFile(tscPath, newContent);

0 commit comments

Comments
 (0)