codexapi 0.3.0__tar.gz → 0.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: codexapi
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Minimal Python API for running the Codex CLI.
5
5
  License: MIT
6
6
  Keywords: codex,agent,cli,openai
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "codexapi"
7
- version = "0.3.0"
7
+ version = "0.3.1"
8
8
  description = "Minimal Python API for running the Codex CLI."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -12,4 +12,4 @@ __all__ = [
12
12
  "task",
13
13
  "task_result",
14
14
  ]
15
- __version__ = "0.3.0"
15
+ __version__ = "0.3.1"
@@ -224,19 +224,20 @@ def _is_session_file(path, root_str):
224
224
 
225
225
  def _list_codex_processes():
226
226
  result = subprocess.run(
227
- ["ps", "-ax", "-o", "pid=,ppid=,comm=,args="],
227
+ ["ps", "-ax", "-o", "pid=,ppid=,uid=,comm=,args="],
228
228
  capture_output=True,
229
229
  text=True,
230
230
  )
231
231
  if result.returncode != 0:
232
232
  return []
233
+ current_uid = os.getuid()
233
234
  processes = []
234
235
  for line in result.stdout.splitlines():
235
236
  line = line.strip()
236
237
  if not line:
237
238
  continue
238
- parts = line.split(None, 3)
239
- if len(parts) < 3:
239
+ parts = line.split(None, 4)
240
+ if len(parts) < 4:
240
241
  continue
241
242
  try:
242
243
  pid = int(parts[0])
@@ -246,8 +247,14 @@ def _list_codex_processes():
246
247
  ppid = int(parts[1])
247
248
  except ValueError:
248
249
  continue
249
- comm = parts[2]
250
- args = parts[3] if len(parts) > 3 else ""
250
+ try:
251
+ uid = int(parts[2])
252
+ except ValueError:
253
+ continue
254
+ if uid != current_uid:
255
+ continue
256
+ comm = parts[3]
257
+ args = parts[4] if len(parts) > 4 else ""
251
258
  if comm == "codex" or re.search(r"(^|[\\s/])codex(\\s|$)", args):
252
259
  processes.append({"pid": pid, "ppid": ppid, "comm": comm, "args": args})
253
260
  return processes
@@ -273,7 +280,11 @@ def _process_session_files(pid, root):
273
280
 
274
281
  proc_fd = Path(f"/proc/{pid}/fd")
275
282
  if proc_fd.exists():
276
- for entry in proc_fd.iterdir():
283
+ try:
284
+ entries = list(proc_fd.iterdir())
285
+ except OSError:
286
+ return paths
287
+ for entry in entries:
277
288
  try:
278
289
  target = os.readlink(entry)
279
290
  except OSError:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: codexapi
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Minimal Python API for running the Codex CLI.
5
5
  License: MIT
6
6
  Keywords: codex,agent,cli,openai
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes