Skip to content

Commit bff759b

Browse files
committed
Merge pull request #376 from dmethvin/optional-rc
Fix #364. In WSH, return empty string for files not found.
2 parents 0e85f26 + 1cb003f commit bff759b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/cli/wsh.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,18 @@ var wshapi = (function(){
122122

123123
readFile: function(path){
124124
var forReading = 1;
125-
var tf = fso.OpenTextFile(path, forReading);
126-
var allText = tf.ReadAll();
127-
tf.Close();
125+
var allText;
126+
try {
127+
var tf = fso.OpenTextFile(path, forReading);
128+
allText = tf.ReadAll();
129+
tf.Close();
130+
} catch (ex) {
131+
return "";
132+
}
128133
return allText;
129134
}
130135
};
131136

132137
}());
133138

134-
cli(wshapi);
139+
cli(wshapi);

0 commit comments

Comments
 (0)