A wrapper for NSPopen that additionally checks if the program to be executed is available from the system path or not. If found, it proceeds with the usual NSPopen() call. Otherwise, it raises an exception.
| 68 | return decorator |
| 69 | |
| 70 | class NSPopenWithCheck(NSPopen): |
| 71 | """ |
| 72 | A wrapper for NSPopen that additionally checks if the program |
| 73 | to be executed is available from the system path or not. |
| 74 | If found, it proceeds with the usual NSPopen() call. |
| 75 | Otherwise, it raises an exception. |
| 76 | """ |
| 77 | |
| 78 | def __init__(self, nsname, *argv, **kwarg): |
| 79 | name = list(argv)[0][0] |
| 80 | has_executable(name) |
| 81 | super(NSPopenWithCheck, self).__init__(nsname, *argv, **kwarg) |
| 82 | |
| 83 | KERNEL_VERSION_PATTERN = r"v?(?P<major>[0-9]+)\.(?P<minor>[0-9]+).*" |
| 84 |