-
Notifications
You must be signed in to change notification settings - Fork 4
Gendarme.Rules.Portability.FeatureRequiresRootPrivilegeOnUnixRule(git)
Sebastien Pouliot edited this page Mar 2, 2011
·
1 revision
Assembly: Gendarme.Rules.Portability
Version: git
This rule fires if a feature is used which is, by default, restricted under Unix.
- System.Net.NetworkInformation.Ping : This type can only be used by root on Unix systems. As an alternative you can execute the ping command and parse its result.
- System.Diagnostics.Process : The PriorityClass property can only be set to Normal by non-root users. To avoid this problem you can do a platform check before assigning a priority.
Bad example:
process.PriorityClass = ProcessPriorityClass.AboveNormal;
process.Start ();
Good example:
if (Environment.OSVersion.Platform != PlatformID.Unix) {
process.PriorityClass = ProcessPriorityClass.AboveNormal;
}
process.Start ();
You can browse the latest source code of this rule on github.com
Note that this page was autogenerated (3/17/2011 1:55:44 PM) based on the xmldoc
comments inside the rules source code and cannot be edited from this wiki.
Please report any documentation errors, typos or suggestions to the
Gendarme Mailing List. Thanks!