Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add meson.run command #70

Merged
merged 22 commits into from
Jul 1, 2023
Merged

Add meson.run command #70

merged 22 commits into from
Jul 1, 2023

Conversation

stefanv
Copy link
Member

@stefanv stefanv commented Mar 29, 2023

The command operates in two modes. If a single argument is given, it uses subprocess's shell=True, so you can use shell substitution, as in:

spin run 'echo $PYTHONPATH'

If multiple arguments are given, it uses standard execution, e.g.:

spin run python -c 'import sys; del sys.path[0]; import example_pkg'

Enabling shell=True for the latter would incorrectly disregarded the quoting.

Closes #69

The command operates in two modes. If a single argument is given, it
uses subprocess's `shell=True`, so you can use shell substitution, as in:

  spin run 'echo $PYTHONPATH'

If multiple arguments are given, it uses standard execution, e.g.:

  spin run python -c 'import sys; del sys.path[0]; import example_pkg'

Enabling `shell=True` for the latter would incorrectly disregarded the
quoting.
@adam2392
Copy link
Contributor

Thanks!

Quick question, upon skimming the code, it's not clear to me when do you use single quotes vs no quotes? Is it worth documenting?

@stefanv
Copy link
Member Author

stefanv commented Mar 29, 2023

Quick question, upon skimming the code, it's not clear to me when do you use single quotes vs no quotes? Is it worth documenting?

I can make that more explicit, although this is standard shell behavior. If you don't use quotes, then your current shell will immediately expand variables like $PYTHONPATH, instead of doing that expansion once the job is running.

@stefanv stefanv force-pushed the run branch 2 times, most recently from 47c49c7 to 4d7ff76 Compare April 1, 2023 00:38
@stefanv
Copy link
Member Author

stefanv commented Apr 4, 2023

I can't quite get Windows to do what I want, but I'm getting hold of a physical test machine soon which should help debugging significantly.

@jarrodmillman jarrodmillman added this to the 0.3 milestone Apr 4, 2023
@jarrodmillman jarrodmillman modified the milestones: 0.3, 0.4 Jun 28, 2023
@stefanv
Copy link
Member Author

stefanv commented Jul 1, 2023

Phew 😅

@jarrodmillman jarrodmillman merged commit fd654e1 into scientific-python:main Jul 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Run a command in the shell without invoking the shell
3 participants