From: daniel@...42.com Date: 2020-03-11T17:38:40+00:00 Subject: [ruby-core:97452] [Ruby master Feature#16688] Allow #to_path object as argument to system() Issue #16688 has been updated by Dan0042 (Daniel DeLorme). I don't know the downsides, just that `Pathname#to_str` was specifically _removed_ 10 years ago: #1970 So I imagine there were some design considerations there... ---------------------------------------- Feature #16688: Allow #to_path object as argument to system() https://bugs.ruby-lang.org/issues/16688#change-84596 * Author: Dan0042 (Daniel DeLorme) * Status: Open * Priority: Normal ---------------------------------------- I often work with Pathname objects, but when passing them to a system command I find it a bit tedious that they have to be explicitly converted to a String. ```ruby file = BASE + "config.json" system(@cmd, file) #=> TypeError (no implicit conversion of Pathname into String) system(@cmd, file.to_s) #=> works ``` I propose that the system/exec/spawn family of methods should try to convert their arguments using `to_path`, if `to_str` fails. I believe it makes perfect sense, since commandline arguments are so often pathnames. -- https://bugs.ruby-lang.org/ Unsubscribe: