Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

Commit

Permalink
Fix #876, Correct handling of quotation marks in commands
Browse files Browse the repository at this point in the history
- remove extra quotes around `cmd /c` arguments
 - prevented && and similar special cases
- don't strip quotes surrounding command-line arguments
 - prevented command paths and arguments containing spaces
- `CommandGrammar` may need additional generalizations
 - e.g. unquoted term can't contain more than one escape sequence
 - but it's probably good enough for now

nit:
- let VS do its thing with test services
  • Loading branch information
dougbu committed May 22, 2015
1 parent 4bb7649 commit 2cfc316
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ public CommandGrammar(Func<string, string> variable)

var unquotedTerm = Rep1(unquotedPiece.Or(specialPiece)).Str();

var quotedTerm = Ch('\"').And(Rep(quotedPiece.Or(specialPiece)).Str()).And(Ch('\"')).Left().Down();
var quotedTerm = Ch('\"').And(Rep(quotedPiece.Or(specialPiece)).Str()).And(Ch('\"'))
.Left().Down()
.Build(str => "\"" + str + "\"");

var whitespace = Rep(Ch(' '));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ public bool Execute(Runtime.Project project, string scriptName, Func<string, str
if (!string.IsNullOrEmpty(comSpec))
{
scriptArguments =
new[] { comSpec, "/C", "\"" }
new[] { comSpec, "/C" }
.Concat(scriptArguments)
.Concat(new[] { "\"" })
.ToArray();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

0 comments on commit 2cfc316

Please sign in to comment.