forked from containers/toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/run: Optimize 'enter' and 'run' in the non-fallback case
Currently, the 'enter' command involves two extra invocations of 'podman exec' to detect if the user's chosen shell and current working directory are present inside the toolbox container. Each invocation is sufficiently expensive to add a noticeable overhead to the 'enter' and 'run' commands. Moreover, file system operations being inherently racy, it's always better to detect errors and handle them instead of trying to pre-emptively avoid them. Therefore, this shuffles the code around to attempt the non-fallback invocation, and then handle the errors by attempting a series of fallbacks for the command and the current working directory. Unfortunately, in case of a missing command, capsh(1) adds an extra error message that seems difficult to get rid of: $ toolbox enter /bin/sh: /bin/zsh: No such file or directory Error: command /bin/zsh not found in container fedora-toolbox-34 Using /bin/bash instead. containers#813
- Loading branch information
1 parent
323afb9
commit 4536e2c
Showing
1 changed file
with
75 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters