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

OS detection fails on OSX (Trac #1227) #581

Closed
phing-issues-importer opened this issue Oct 9, 2016 · 2 comments
Closed

OS detection fails on OSX (Trac #1227) #581

phing-issues-importer opened this issue Oct 9, 2016 · 2 comments

Comments

@phing-issues-importer
Copy link

phing-issues-importer commented Oct 9, 2016

When detecting the OS on a machine running OSX, using the tag both "unix" and "mac" families are matched. Sample build.xml:

<project name="test-os" default="os-setup">
        <target name="os-setup">
        <if>
            <os family="windows" />
            <then>
                <echo>It's windows</echo>
            </then>
        </if>
        <if>
            <os family="mac" />
            <then>
                <echo>It's a mac</echo>
            </then>
        </if>
        <if>
            <os family="unix" />
            <then>
                <echo>It's unix</echo>
            </then>
        </if>
        </target>
</project>

outputs

test-os > os-setup:

     [echo] It's a mac
     [echo] It's unix

BUILD FINISHED

Total time: 0.0901 seconds

Tested on OSX Yosemite.

Migrated from https://www.phing.info/trac/ticket/1227

{
    "status": "new", 
    "changetime": "2015-11-19T09:56:27", 
    "description": "When detecting the OS on a machine running OSX, using the <os/> tag both \"unix\" and \"mac\" families are matched. Sample build.xml:\n\n{{{\n<project name=\"test-os\" default=\"os-setup\">\n        <target name=\"os-setup\">\n        <if>\n            <os family=\"windows\" />\n            <then>\n                <echo>It's windows</echo>\n            </then>\n        </if>\n        <if>\n            <os family=\"mac\" />\n            <then>\n                <echo>It's a mac</echo>\n            </then>\n        </if>\n        <if>\n            <os family=\"unix\" />\n            <then>\n                <echo>It's unix</echo>\n            </then>\n        </if>\n        </target>\n</project>\n}}}\n\noutputs\n\n{{{\ntest-os > os-setup:\n\n     [echo] It's a mac\n     [echo] It's unix\n\nBUILD FINISHED\n\nTotal time: 0.0901 seconds\n}}}\n\nTested on OSX Yosemite.", 
    "reporter": "george.simion@gmail.com", 
    "cc": "", 
    "resolution": "", 
    "_ts": "1447926987000288", 
    "component": "phing-core", 
    "summary": "OS detection fails on OSX", 
    "priority": "tbd", 
    "keywords": "", 
    "version": "2.12.0", 
    "time": "2015-11-18T14:03:41", 
    "milestone": "Backlog", 
    "owner": "mrook", 
    "type": "defect"
}
@siad007
Copy link
Member

siad007 commented Oct 23, 2016

This is normal behavior - you can be even more specific with conditions:

<condition property="isMacOsButNotMacOsX">
    <and>
      <os family="mac"/>
      <not>
        <os family="unix"/>
      </not>
    </and>
</condition>

@mrook
Copy link
Member

mrook commented Nov 2, 2016

Nice example @siad007, I'll add that to the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants