Skip to content
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: Array issue with postRunCommand #122

Merged
merged 4 commits into from
May 24, 2024

Conversation

joncrain
Copy link
Contributor

@joncrain joncrain commented Apr 24, 2024

Prefs stored as an array throw an error:

% sudo /Library/Crypt/checkin
panic: interface conversion: interface {} is []string, not string

This should give the option for either a string or an array.

@grahamgilbert
Copy link
Owner

Fairly certain you're going to still panic here. If the wiki says it's an array, then it should be an array. Remove the cast to string.

@joncrain
Copy link
Contributor Author

joncrain commented Apr 25, 2024

I think you're right that the initial code will not work as expected. However, my concern would be that some people do have this set as a string. The wiki does allow for both it seems:

This preference can either be a string if your command has no spaces, or an array if there are spaces in the command.

So I think it would be best to support both.

@joncrain
Copy link
Contributor Author

Tested the latest change and it does not panic for string or array and works as expected.

@grahamgilbert
Copy link
Owner

Looks good. Do you think it would be possible to split this logic out into its out function so there can be unit tests?

@joncrain
Copy link
Contributor Author

Split the get command and added tests for it.

@grahamgilbert grahamgilbert merged commit 0af2c4d into grahamgilbert:master May 24, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants