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

Using Pathname to check for absolute path in ruby script #550

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/cmd/cmdtransport.rb.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

require 'open3'
require 'pathname'

# Constants.
LIBRARY_VERSION = '@PROJECT_VERSION_FULL@'
Expand All @@ -31,10 +31,7 @@ class Cmd
command = args[0]
exe_name = COMMANDS[command]

if exe_name[0] == '/'
# If the first character is a slash, we'll assume that we've been given an
# absolute path to the executable. This is only used during test mode.
else
unless Pathname.new(exe_name).absolute?
# We're assuming that the library path is relative to the current
# location of this script.
exe_name = File.expand_path(File.join(File.dirname(__FILE__), exe_name))
Expand Down
Loading