File tree 5 files changed +20
-17
lines changed
5 files changed +20
-17
lines changed Original file line number Diff line number Diff line change @@ -65,16 +65,14 @@ public function handle(): int
65
65
$ hook ->install ();
66
66
67
67
if ($ this ->option ('verbose ' )) {
68
- $ this ->info ("{$ hook ->name } git hook installed successfully . " );
68
+ $ this ->info ("Ensuring {$ hook ->name } hook is executable.. . " );
69
69
}
70
- } );
70
+ $ hook -> ensureExecutable ( );
71
71
72
- if ($ this ->platform ->isNotWindows ()) {
73
72
if ($ this ->option ('verbose ' )) {
74
- $ this ->info (' Verifying hooks are executable... ' );
73
+ $ this ->info ("{ $ hook -> name } git hook installed successfully. " );
75
74
}
76
- exec ('chmod +x ' .Platform::cwd ('.git/hooks ' ).'/* ' );
77
- }
75
+ });
78
76
79
77
$ this ->info ('Git hooks installed successfully. ' );
80
78
Original file line number Diff line number Diff line change @@ -42,19 +42,16 @@ public function handle(): int
42
42
}
43
43
44
44
$ hook ->install ();
45
- $ hook ->ensureExecutable ();
46
45
47
46
if ($ this ->option ('verbose ' )) {
48
- $ this ->info ("{$ hook ->name } git hook installed successfully . " );
47
+ $ this ->info ("Ensuring {$ hook ->name } hook is executable.. . " );
49
48
}
50
- } );
49
+ $ hook -> ensureExecutable ( );
51
50
52
- if ($ this ->platform ->isNotWindows ()) {
53
51
if ($ this ->option ('verbose ' )) {
54
- $ this ->info (' Verifying hooks are executable... ' );
52
+ $ this ->info ("{ $ hook -> name } git hook installed successfully. " );
55
53
}
56
- exec ('chmod +x ' .Platform::cwd ('.git/hooks ' ).'/* ' );
57
- }
54
+ });
58
55
59
56
$ this ->line ('Git hooks updated successfully. ' );
60
57
Original file line number Diff line number Diff line change @@ -91,7 +91,10 @@ public function enable(): void
91
91
public function ensureExecutable (): void
92
92
{
93
93
if ((new Platform )->isNotWindows ()) {
94
- exec ('chmod +x ' .Platform::cwd (".git/hooks/ {$ this ->hook }" ));
94
+ $ path = Platform::cwd (".git/hooks/ {$ this ->hook }" );
95
+ $ path = Platform::escapeSpaces ($ path );
96
+
97
+ exec ("chmod +x {$ path }" );
95
98
}
96
99
}
97
100
Original file line number Diff line number Diff line change @@ -26,15 +26,18 @@ public static function temp_test_path(string $path = ''): string
26
26
27
27
public static function normalizePath (string $ path ): string
28
28
{
29
- $ path = str_replace (' ' , '\\ ' , $ path );
30
-
31
29
if ((new self )->isWindows ()) {
32
30
return str_replace ('\\' , '/ ' , $ path );
33
31
}
34
32
35
33
return $ path ;
36
34
}
37
35
36
+ public static function escapeSpaces (string $ path ): string
37
+ {
38
+ return preg_replace ('/(?<! \\\) / ' , '\\ ' , $ path );
39
+ }
40
+
38
41
public static function getGlobalComposerHome (): string
39
42
{
40
43
return rtrim (shell_exec ('composer -n global config home --quiet ' ), "\n" );
Original file line number Diff line number Diff line change @@ -19,11 +19,13 @@ public static function base_path(string $path = ''): string
19
19
20
20
public static function bin_path (): string
21
21
{
22
- return Platform::normalizePath (match (true ) {
22
+ $ path = Platform::normalizePath (match (true ) {
23
23
self ::dogfooding () => Platform::cwd ('whisky ' ),
24
24
self ::isRunningGlobally () => Platform::getGlobalComposerBinDir ().'/whisky ' ,
25
25
default => Platform::cwd ('vendor/bin/whisky ' ),
26
26
});
27
+
28
+ return Platform::escapeSpaces ($ path );
27
29
}
28
30
29
31
public static function dogfooding (): bool
You can’t perform that action at this time.
0 commit comments