[pypy-svn] r45265 - pypy/dist/pypy/module/posix

fijal at codespeak.net fijal at codespeak.net
Mon Jul 23 12:23:54 CEST 2007


Author: fijal
Date: Mon Jul 23 12:23:54 2007
New Revision: 45265

Modified:
   pypy/dist/pypy/module/posix/__init__.py
   pypy/dist/pypy/module/posix/interp_posix.py
Log:
(exarkun) os.setsid implementation, app-level


Modified: pypy/dist/pypy/module/posix/__init__.py
==============================================================================
--- pypy/dist/pypy/module/posix/__init__.py	(original)
+++ pypy/dist/pypy/module/posix/__init__.py	Mon Jul 23 12:23:54 2007
@@ -83,6 +83,9 @@
     #    interpleveldefs['uname'] = 'interp_posix.uname'
     if hasattr(os, 'ttyname'):
         interpleveldefs['ttyname'] = 'interp_posix.ttyname'
+    if hasattr(os, 'setsid'):
+        interpleveldefs['setsid'] = 'interp_posix.setsid'
+    
     for name in w_star:
         if hasattr(os, name):
             interpleveldefs[name] = 'interp_posix.' + name

Modified: pypy/dist/pypy/module/posix/interp_posix.py
==============================================================================
--- pypy/dist/pypy/module/posix/interp_posix.py	(original)
+++ pypy/dist/pypy/module/posix/interp_posix.py	Mon Jul 23 12:23:54 2007
@@ -499,6 +499,18 @@
         raise OperationError(space.w_TypeError, space.wrap(msg))
 utime.unwrap_spec = [ObjSpace, str, W_Root]
 
+def setsid(space):
+    """setsid() -> pid
+    
+    Creates a new session with this process as the leader.
+    """
+    try:
+        result = os.setsid()
+    except OSError, e:
+        raise wrap_oserror(space, e)
+    return space.wrap(result)
+setsid.unwrap_spec = [ObjSpace]
+
 def declare_new_w_star(name):
     if name in w_star_returning_int:
         def WSTAR(space, status):



More information about the Pypy-commit mailing list