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

print warning and resolve to absolute path for commands specified with relative path #320

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

boegel
Copy link
Member

@boegel boegel commented Oct 12, 2021

No description provided.

lib/vsc/utils/run.py Outdated Show resolved Hide resolved
lib/vsc/utils/run.py Outdated Show resolved Hide resolved
@@ -87,6 +87,38 @@
SHELL = BASH


def ensure_cmd_abs_path(cmd):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allow to pass path to which

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in 919b9ec

@@ -172,7 +204,7 @@ def __init__(self, cmd=None, **kwargs):
if not hasattr(self, 'log'):
self.log = getLogger(self._get_log_name())

self.cmd = cmd # actual command
self.cmd = ensure_cmd_abs_path(cmd) # actual command
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allow path as kwargs (call it command_path to avoid any conflict with other)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in 919b9ec

@boegel
Copy link
Member Author

boegel commented Oct 12, 2021

Tests fail on:

OSError: Command PYTHONPATH="..." not found in $PATH!

That's a special case I haven't taken into account yet, indeed: the command to run is not necessarily the first string value, there may be environment stuff in front of it... Oh boy.

@stdweird Any suggestions come to mind on how to handle this edge case?

@itkovian
Copy link
Member

Split on and drop everything that matches a [a-z0-9A-Z_]+=[^ ]+ at the start of the list?

@stdweird
Copy link
Member

@boegel solution is to only set absolute path when no shell is being used. in a shell, the shell will do this anyway

@wdpypere
Copy link
Contributor

wdpypere commented Mar 7, 2023

@boegel is this still needed? tbh, now we went py3 only I would suggest using pathlib is_absolute() but it seems this was never implemented?

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.

4 participants