Skip to content

How to execute multi-line commands in the post_install script? #3432

Answered by noirbizarre
kwdiwt asked this question in Q&A
Discussion options

You must be logged in to vote

Note that shell snippet being passed to the shell interpreter, it is also possible to write:

[tool.pdm.scripts]
post_install.shell = """
pdm run playwright install-deps
pdm run playwright install
"""

or if you want indentation, this work too:

[tool.pdm.scripts]
post_install.shell = """
	pdm run playwright install-deps
	pdm run playwright install
"""

However, the default behavior is not to stop on error, so to have the same behavior as your && you will need

[tool.pdm.scripts]
post_install.shell = """
set -e
pdm run playwright install-deps
pdm run playwright install
"""

Composite will provide the same behavior without the need for set -e as it will stop on the first failing command:

[tool.pdm.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@frostming
Comment options

@noirbizarre
Comment options

Answer selected by kwdiwt
@kwdiwt
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants