Skip to content

Commit d14c0d0

Browse files
committed
Fix macos
1 parent 02cba44 commit d14c0d0

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

__tests__/utils.test.ts

+12-11
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ describe('Utils tests', () => {
4242
it('checking asyncForEach', async () => {
4343
const array: Array<string> = ['a', 'b', 'c'];
4444
let concat = '';
45-
await utils.asyncForEach(array, async function (
46-
str: string
47-
): Promise<void> {
48-
concat += str;
49-
});
45+
await utils.asyncForEach(
46+
array,
47+
async function (str: string): Promise<void> {
48+
concat += str;
49+
}
50+
);
5051
expect(concat).toBe('abc');
5152
});
5253

@@ -83,12 +84,12 @@ describe('Utils tests', () => {
8384
const runner_dir: string = process.env['RUNNER_TOOL_CACHE'] || '';
8485
const script_path: string = path.join(runner_dir, 'test.sh');
8586
await utils.writeScript('test.sh', testString);
86-
await fs.readFile(script_path, function (
87-
error: Error | null,
88-
data: Buffer
89-
) {
90-
expect(testString).toBe(data.toString());
91-
});
87+
await fs.readFile(
88+
script_path,
89+
function (error: Error | null, data: Buffer) {
90+
expect(testString).toBe(data.toString());
91+
}
92+
);
9293
await cleanup(script_path);
9394
});
9495

src/scripts/darwin.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ add_php() {
102102
brew tap --shallow shivammathur/php
103103
fi
104104
update_dependencies
105-
if brew list php@"$version" 2>/dev/null | grep -q "Error" && [ "$action" != "upgrade" ]; then
106-
brew unlink php@"$version"
105+
if ! [[ "$(find "$(brew --cellar)"/php/ -maxdepth 1 -name "$version*" | wc -l 2>/dev/null)" -eq 0 ]] && [ "$action" != "upgrade" ]; then
106+
brew unlink shivammathur/php/php@"$version"
107107
else
108-
brew "$action" shivammathur/php/php@"$version"
108+
brew upgrade "shivammathur/php/php@$version" 2>/dev/null || brew install "shivammathur/php/php@$version"
109109
fi
110110
brew link --force --overwrite php@"$version"
111111
}

0 commit comments

Comments
 (0)