Skip to content

subprocess.SubprocessError: Exception occurred in preexec_fn. #6489

Closed

Description

@anki-code

Hello! I'm trying to run xonsh shell using rustpython on Mac but faced with error:

xonsh
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh  # https://rustup.rs/
# restart shell
cargo install --features=ssl --git https://github.com/RustPython/RustPython rustpython
$PATH.append(p'~/.cargo/bin')
#rustpython -m site  # to get locations
rustpython --install-pip
rustpython -m pip install xonsh   

Note! No prompt-toolkit as workaround #6487

~/.local/bin/xonsh --no-rc --no-env
# Skipping setup. Because no `readline` implementation available.
$XONSH_SHOW_TRACEBACK = True
ls

Result:

xonsh: To log full traceback to a file set: $XONSH_TRACEBACK_LOGFILE = <filename>
Traceback (most recent call last):
  File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/procs/pipelines.py", line 177, in __init__
    proc = spec.run(pipeline_group=pipeline_group)
  File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/procs/specs.py", line 528, in run
    p = self._run_binary(kwargs)
  File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/procs/specs.py", line 585, in _run_binary
    raise xt.XonshError(e) from ex
  File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/procs/specs.py", line 546, in _run_binary
    p = self.cls(cmd, bufsize=bufsize, **kwargs)
  File "/Users/pc/.cargo/git/checkouts/rustpython-63090cdce5e18442/7c3bc5e/crates/pylib/Lib/subprocess.py", line 1062, in __init__
    raise
  File "/Users/pc/.cargo/git/checkouts/rustpython-63090cdce5e18442/7c3bc5e/crates/pylib/Lib/subprocess.py", line 1034, in __init__
    start_new_session, process_group)
  File "/Users/pc/.cargo/git/checkouts/rustpython-63090cdce5e18442/7c3bc5e/crates/pylib/Lib/subprocess.py", line 1958, in _execute_child
    raise child_exception_type(err_msg)
subprocess.SubprocessError: Exception occurred in preexec_fn.

For community

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

Activity

  1. coderabbitai commented on Dec 24, 2025

    @coderabbitai
    Contributor

    📝 CodeRabbit Plan Mode

    Generate an implementation plan and prompts that you can use with your favorite coding agent.

    • Create Plan
    Examples

    🔗 Similar Issues

    Related Issues

    🔗 Related PRs

    #6187 - Handle OsError in REPL [merged]

    👤 Suggested Assignees

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  2. youknowone commented on Dec 24, 2025

    @youknowone
    Member

    a20f2cc will fix it. included in #6484

  3. anki-code commented on Dec 24, 2025

    @anki-code
    Author

    @youknowone I've tested and now it works better:

    cargo install --features=ssl --git https://github.com/youknowone/RustPython --branch os rustpython
    ~/.local/bin/xonsh --no-rc --no-env
    $XONSH_SHOW_TRACEBACK = True
    ls
    # Documents Downloads ...

    And after the list of files:

    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/built_ins.py", line 271, in subproc_captured_hiddenobject
        return xonsh.procs.specs.run_subproc(cmds, captured="hiddenobject", envs=envs)
      File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/procs/specs.py", line 1135, in run_subproc
        return _run_specs(specs, cmds)
      File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/procs/specs.py", line 1162, in _run_specs
        cp = _run_command_pipeline(specs, cmds)
      File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/procs/specs.py", line 1141, in _run_command_pipeline
        cp = HiddenCommandPipeline(specs)
      File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/procs/pipelines.py", line 190, in __init__
        if update_process_group(pipeline_group, background):
      File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/procs/pipelines.py", line 91, in update_process_group
        return xj.give_terminal_to(pipeline_group)
      File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/procs/jobs.py", line 329, in give_terminal_to
        _pthread_sigmask(signal.SIG_SETMASK, oldmask)
      File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/procs/jobs.py", line 327, in give_terminal_to
        raise
      File "/Users/pc/.local/lib/rustpython3.13/site-packages/xonsh/procs/jobs.py", line 309, in give_terminal_to
        os.tcsetpgrp(FD_STDERR, pgid)
    AttributeError: module 'os' has no attribute 'tcsetpgrp'
  4. youknowone commented on Dec 25, 2025

    @youknowone
    Member

    Both fixed by #6484

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions