Skip to content

Commit

Permalink
fix: FileNotFoundError with pdm run and process substitution
Browse files Browse the repository at this point in the history
Fixes #3252

Signed-off-by: Frost Ming <[email protected]>
  • Loading branch information
frostming committed Nov 6, 2024
1 parent 387d211 commit 214012b
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 214012b

Please sign in to comment.