package org.projectodd.nodej.bindings.os;

import java.util.HashMap;
import java.util.Map;

import org.dynjs.runtime.ExecutionContext;
import org.dynjs.runtime.GlobalObject;

public class GetOSType extends OsFunctionBinding {
    
    private static Map<String, String> names = new HashMap<String, String>();
    static {
        names.put("Mac OS X", "Darwin");
    }
    
    public GetOSType(GlobalObject globalObject) {
        super(globalObject);
    }

    @Override
    public Object call(ExecutionContext context, Object self, Object... args) {
        String name = System.getProperty("os.name");
        if (names.get(name) != null) {
            return names.get(name);
        }
        return name;
    }
}
@@ -166,16 +166,91 @@
 lObject;
+%0Aimport org.hyperic.sigar.SigarException;%0Aimport org.hyperic.sigar.SysInfo;
 %0A%0Apublic
@@ -377,16 +377,45 @@
 ing%3E();%0A
+    private SysInfo sysInfo;%0A
     stat
@@ -445,12 +445,10 @@
 %22Mac
- 
 OS
- 
 X%22, 
@@ -548,16 +548,178 @@
 bject);%0A
+        sysInfo = new SysInfo();%0A        try %7B%0A            sysInfo.gather(sigar);%0A        %7D catch (SigarException e) %7B%0A            e.printStackTrace();%0A        %7D%0A
     %7D%0A%0A 
@@ -837,36 +837,50 @@
 e = 
-System.getProperty(%22os.name%22
+%22unknown%22;%0A        name = sysInfo.getName(
 );%0A 

Use sigar for uname.