Skip to content

Commit 61ce5b3

Browse files
authored
Fix parsing quoted empty arg in response file (#185)
1 parent 1ceb048 commit 61ce5b3

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ jobs:
100100
name: test-logs-${{ matrix.os }}-node${{ matrix.node-version }}-${{ matrix.configuration }}
101101
path: |
102102
out/obj/${{ matrix.configuration }}/**/*.log
103+
out/obj/${{ matrix.configuration }}/**/*.rsp
103104
out/test/**/*.trx
104105
105106
- name: Check formatting

src/NodeApi.Generator/ModuleGenerator.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ public class ModuleGenerator : SourceGenerator, ISourceGenerator
3838

3939
public GeneratorExecutionContext Context { get; protected set; }
4040

41+
#pragma warning disable IDE0060 // Unused parameter
4142
public void Initialize(GeneratorInitializationContext context)
43+
#pragma warning restore IDE0060
4244
{
4345
// Note source generators cannot be directly launched in a debugger,
4446
// because the generator runs at build time, not at application run-time.

src/NodeApi.Generator/Program.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,17 +281,20 @@ private static IEnumerable<string> SplitWithQuotes(string line)
281281
{
282282
StringBuilder s = new();
283283
bool inQuotes = false;
284+
bool foundQuotes = false;
284285
foreach (char c in line)
285286
{
286287
if (c == '"')
287288
{
288289
inQuotes = !inQuotes;
290+
foundQuotes = true;
289291
}
290292
else if (c == ' ' && !inQuotes)
291293
{
292-
if (s.Length > 0)
294+
if (s.Length > 0 || foundQuotes)
293295
{
294296
yield return s.ToString();
297+
foundQuotes = false;
295298
s.Clear();
296299
}
297300
}
@@ -301,7 +304,7 @@ private static IEnumerable<string> SplitWithQuotes(string line)
301304
}
302305
}
303306

304-
if (s.Length > 0)
307+
if (s.Length > 0 || foundQuotes)
305308
{
306309
yield return s.ToString();
307310
}
@@ -344,7 +347,7 @@ private static void ResolveSystemAssemblies(
344347
{
345348
if (targetingPacks.Count == 0)
346349
{
347-
// If no targeting packs were specified, use the deafult targeting pack for .NET.
350+
// If no targeting packs were specified, use the default targeting pack for .NET.
348351
targetingPacks.Add("Microsoft.NETCore.App");
349352
}
350353

0 commit comments

Comments
 (0)