mirror of
https://github.com/actions/runner.git
synced 2025-12-11 21:06:55 +00:00
docker: escape key-value pair as -e KEY and VALUE being environment var (#2091)
* docker: escape key-value pair as -e KEY and VALUE being environment var * removed code duplication, removed unused method and test
This commit is contained in:
@@ -71,15 +71,6 @@ namespace GitHub.Runner.Worker.Container
|
||||
return $"{flag} \"{EscapeString(key)}\"";
|
||||
}
|
||||
|
||||
public static string CreateEscapedOption(string flag, string key, string value)
|
||||
{
|
||||
if (String.IsNullOrEmpty(key))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return $"{flag} \"{EscapeString(key)}={EscapeString(value)}\"";
|
||||
}
|
||||
|
||||
private static string EscapeString(string value)
|
||||
{
|
||||
return value.Replace("\\", "\\\\").Replace("\"", "\\\"");
|
||||
|
||||
Reference in New Issue
Block a user