Skip to content

Commit

Permalink
fix: FileNotFoundError with pdm run and process substitution (#3260)
Browse files Browse the repository at this point in the history
  • Loading branch information
frostming authored Nov 6, 2024
1 parent 387d211 commit ea39d36
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions news/3252.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Inherit file descriptors instead of closing when running child processes in `pdm run`.
6 changes: 3 additions & 3 deletions src/pdm/cli/commands/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,11 @@ def forward_signal(signum: int, frame: FrameType | None) -> None:

handle_term = signal.signal(signal.SIGTERM, forward_signal)
handle_int = signal.signal(signal.SIGINT, forward_signal)
process = subprocess.Popen(process_cmd, cwd=cwd, shell=shell, bufsize=0)
process.wait()
process = subprocess.Popen(process_cmd, cwd=cwd, shell=shell, bufsize=0, close_fds=False)
retcode = process.wait()
signal.signal(signal.SIGTERM, handle_term)
signal.signal(signal.SIGINT, handle_int)
return process.returncode
return retcode

def run_task(
self, task: Task, args: Sequence[str] = (), opts: TaskOptions | None = None, seen: set[str] | None = None
Expand Down

0 comments on commit ea39d36

Please sign in to comment.