Skip to content

Commit 6f0dbfb

Browse files
committed
hail mary
1 parent 2d88b73 commit 6f0dbfb

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

tests/Credentials/ExternalAccountCredentialsTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,9 @@ public function testExecutableCredentialSourceEnvironmentVars()
597597
'id_token' => 'abc',
598598
'expiration_time' => time() + 100,
599599
]);
600+
if (PHP_OS_FAMILY === 'Windows') {
601+
$successJson = str_replace('"', "\'", $successJson);
602+
}
600603
$command = sprintf(
601604
'echo $GOOGLE_EXTERNAL_ACCOUNT_AUDIENCE,$GOOGLE_EXTERNAL_ACCOUNT_TOKEN_TYPE,%s > %s' .
602605
' && echo \'%s\' > \$GOOGLE_EXTERNAL_ACCOUNT_OUTPUT_FILE' .
@@ -612,7 +615,7 @@ public function testExecutableCredentialSourceEnvironmentVars()
612615
// We escape the double quotes and dollar signs that Bash needs to see literally.
613616
// The final command will look like: bash.exe -c "echo $VAR,... '{"..."}' > $FILE ..."
614617
$safeInnerCommand = str_replace('$', '\$', $command);
615-
$command = sprintf('bash -c "%s"', str_replace('"', "\'", $safeInnerCommand));
618+
$command = sprintf('bash -c "%s"', $safeInnerCommand);
616619
} else {
617620
// On Unix/Mac, escapeshellarg() works perfectly for single-quoting the whole command.
618621
$command = sprintf('bash -c %s', escapeshellarg($command));

0 commit comments

Comments
 (0)