-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue with stat format on Linux #698
Conversation
@@ -224,7 +224,7 @@ function Set-NamedPipeMode { | |||
) | |||
chmod $DEFAULT_USER_MODE $PipeFile | |||
if ($IsLinux) { | |||
$mode = stat -c "%A" $PipeFile | |||
$mode = stat -c "%a" $PipeFile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of my depth here but I assume we know that %A works on macOS? Also does the else
below execute on Windows? Or maybe we don't call this function at all on Windows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tylerl0706 almost certainly wrote and tested the script on macOS, so I'm assuming that works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stat -f "%a"
on macOS gives me something totally different
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stat -f "%A"
gives me e.g. 700
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never got the chance to review this because of the cruise but I had a couple comments.
@@ -222,13 +222,20 @@ function Set-NamedPipeMode { | |||
[string] | |||
$PipeFile | |||
) | |||
|
|||
if ($IsWindows) { | |||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wish there was a comment here to explain why this doesn't apply to Windows.
} | ||
else { | ||
elseif ($IsMacOS) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function gets called only if they're on MacOS or Linux. So the "if Windows" check above and this elseif change isn't really needed. On the other hand, if we wanted to make it more robust, we could keep the Windows check in and remove the MacOS & Linux checks on line 328 and 334.
if ($IsLinux) { | ||
$mode = stat -c "%A" $PipeFile | ||
$mode = stat -c "%a" $PipeFile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could have sworn I tested on linux before shipping this... in any case, my bad and good find.
The
stat
usage in the startup script currently does not work on Linux.This changes the
%A
to%a
to make it work.