adam12 changed the topic of #ruby to: Ruby 3.3.1, 3.2.4, 3.1.5 https://www.ruby-lang.org | Logs https://libera.irclog.whitequark.org/ruby
jenrzzz has joined #ruby
<[0x1eef]> Oh woops. No splat. Process.spawn "/bin/sh", "-c", argv.join(" ").
<HappyPassover> ruby doobie doo
jenrzzz has quit [Ping timeout: 252 seconds]
<zayd> [0x1eef]: that works after correcting argv to ARGV
<zayd> thanks
<zayd> how would i get the output of the actual command instead of the pid though? i don't see anything on the ruby docs pages for it
<HappyPassover> some script or code example?
jenrzzz has joined #ruby
<zayd> HappyPassover: https://bpa.st/4HPA basically i'm trying to create something along the lines of this, it keeps giving me the pid of the process it spawns though
<HappyPassover> that is seriously conveluted
<HappyPassover> think differently, various tools, and simpler.
<zayd> HappyPassover: i'm trying to reimplement neofetch in ruby, currently that part is just temporary, i'm going to switch it out for a command more efficient once i get it to actually print output
<zayd> i just copied the line from neofetch to test things before i write the actual command
<HappyPassover> like I said, look at other tools, many more in the CLI software tools realm.
<vms14> you're actually writing a shell script
<HappyPassover> I'm just trying to digest what youa re doing.
<vms14> the whole thing would be cleaner in sh
<zayd> HappyPassover: yeah i'll try to rewrite it to be more simple just give me a second
<HappyPassover> read the book software tools, it will save you decades in your life.
<vms14> and the way you're doing is not using ruby at all
<HappyPassover> <-- best advice ever.
<vms14> it's just a weird sh script
<zayd> vms14: the rest of it is in ruby, it's just that i have to do pci stuff in sh since there doesn't seem to be one file for that that i can parse
<zayd> is there any pci library for ruby that would make things easier?
<HappyPassover> check out ##obscurity-rules for more advice.
<vms14> i would recommend to put your ruby script on that chain
<vms14> and just read from stdin or whatever
jenrzzz has quit [Ping timeout: 260 seconds]
<vms14> also ruby has backticks like in perl
<vms14> those will return the output of the program
<vms14> which is what you want
<HappyPassover> like in shell
<vms14> btw i like to see awk on your chain
<zayd> vms14: i was using backticks before but it seems to run into issues if you run with your user's shell as fish
<HappyPassover> its not unique, and a leftover for various reasons, where pipe may not have been available.
<HappyPassover> we are talking decades ago
<HappyPassover> but they are obscure, and not needed for most reasons.
<vms14> seems you need open3
<HappyPassover> again, think in 'software tools', not some other paradigm.
<HappyPassover> if you do not, you get spaghetti code quickly.
<vms14> i keep thinking it should be a shell script instead
<HappyPassover> and over done, not done dente
<zayd> i have a majority of the thing in native ruby already, so i don't see a reason to write it in sh. i just don't see a good way to do this part of it in native ruby, so i'm running a shell command for it
jenrzzz has joined #ruby
<vms14> just use capture
<vms14> stdout_str, status = Open3.capture2([env,] cmd... [, opts])
<zayd> this can also probably be done by just using `lspci`.match(/something/), no?
jenrzzz has quit [Ping timeout: 255 seconds]
<vms14> that's why i told you were writing a shell script
<vms14> still, it might make sense to filter the output from sh
<vms14> and the way to get rid of that sh command would be to check the files that command checks in order to give you the info
<HappyPassover> the way to get rid of needing cli or tools at the level of shell is to simply do it right (tm)
<zayd> vms14: i was told in #linux that it would require quite a bit of work figuring out how to deal with the files in /sys/bus/pci and all that
<vms14> seems to use libpci
<vms14> yeah, sorry
<vms14> i thought you might be able to find the info on procfs
<zayd> there appears to be a few gems on github for pci stuff but they all are 8+ years old
<vms14> i would try to not require any gem for a script like that
<vms14> yet, they might make everything much better
<vms14> executing commans will always feel wrong
<vms14> commands*
<zayd> i'm only requiring friendly_numbers and optparse so far, i would like to not add anything else besides a config parser but if it makes things a lot easier it is what it is
<vms14> but they add a dependency
<vms14> well i'd say it's wise to not care about that
<vms14> and actually use what you have available
<vms14> if there's a gem that already exists and does what you need, logic says you should use it
<zayd> yeah true, i would add for that, i just don't want to add like 3 million gems when i could already do that stuff with what comes in ruby. that isn't the case for the lspci stuff though, so if i can find a gem that makes things easier for that i would use it
jenrzzz has joined #ruby
<vms14> that said, if i were you i would just use the command xD
<weaksauce> zayd use open3 and instead of awk just use ruby's robust handling
donofrio_ has joined #ruby
<zayd> i don't really see a point in using awk either tbh, i was only copying that in as a test
<zayd> i'll try out open3 i guess
<vms14> hahaha
<weaksauce> > On a Unix-like system, the shell invoked is /bin/sh; otherwise the shell invoked is determined by environment variable ENV['RUBYSHELL'], if defined, or ENV['COMSPEC'] otherwise.
<weaksauce> open3 ^
donofrio has quit [Ping timeout: 245 seconds]
jenrzzz has quit [Ping timeout: 260 seconds]
<weaksauce> technically that is the docs for Process
<weaksauce> .spwan
<weaksauce> .spawn*
<vms14> process.swan
<vms14> a form of ducktyping
donofrio_ has quit [Ping timeout: 260 seconds]
niv has quit [Quit: Powered by LunarBNC: https://LunarBNC.net]
niv has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 256 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
fercell_ has quit [Ping timeout: 252 seconds]
fercell has joined #ruby
xdminsy has quit [Quit: Konversation terminated!]
ih8u has joined #ruby
TomyLobo has quit [Quit: Leaving]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
brokkoli_origin has quit [Ping timeout: 268 seconds]
brokkoli_origin has joined #ruby
konsolebox has joined #ruby
konsolebox_ has joined #ruby
konsolebox has quit [Ping timeout: 256 seconds]
<zayd> gr33n7007h: thanks, i'll add this in, forgot to actually write anything lol
<zayd> i have a book on processing text with ruby i borrowed from my local library, i should probably read that this week
<gr33n7007h> zayd: lol, no worries.
<gr33n7007h> just peice it to together to your needs
<gr33n7007h> also, happy reading ;)
<HappyPassover> text proc is 'chunking
<HappyPassover> perl does a fine job, so does sensetalk, as well as sed or awk.
<gr33n7007h> so does self :P
jenrzzz has joined #ruby
konsolebox_ has quit [Quit: .]
jenrzzz has quit [Ping timeout: 252 seconds]
wyclif has joined #ruby
<HappyPassover> self is amazing
<HappyPassover> what most of the modern GUI concepts came from, other than MVC on smalltalk, and then ObjC/OS/NS
<HappyPassover> self is a 3rd generation prototype, and it worked well.
<HappyPassover> but not commercial, god bless Sun
jenrzzz has joined #ruby
_ht has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
HappyPassover is now known as Bar-B-Que
smp has quit [Quit: ZNC 1.8.2 - https://znc.in]
smp has joined #ruby
Bar-B-Que is now known as HappyPassover
grenierm has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
Trivial has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
Linux_Kerio has joined #ruby
wyclif has quit [Ping timeout: 256 seconds]
wyclif has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
eoli3n has quit [Remote host closed the connection]
eoli3n has joined #ruby
grenierm has quit [Ping timeout: 250 seconds]
jenrzzz has joined #ruby
grenierm has joined #ruby
vms14 has quit [Ping timeout: 268 seconds]
grenierm has quit [Quit: Client closed]
grenierm has joined #ruby
vms14 has joined #ruby
wyclif has quit [Ping timeout: 268 seconds]
vms14 has quit [Remote host closed the connection]
brokkoli_origin has quit [Remote host closed the connection]
ftajhii has quit [Ping timeout: 240 seconds]
brokkoli_origin has joined #ruby
brokkoli_origin has quit [Remote host closed the connection]
xdminsy has joined #ruby
wyclif has joined #ruby
pascal_blaze has joined #ruby
brokkoli_origin has joined #ruby
grenierm has quit [Ping timeout: 250 seconds]
pascal_blaze has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Linux_Kerio has quit [Ping timeout: 260 seconds]
wyclif has quit [Ping timeout: 245 seconds]
ken_barber has joined #ruby
wyclif has joined #ruby
IBUXZiKvk has joined #ruby
wyclif has quit [Ping timeout: 252 seconds]
gaussianblue has joined #ruby
manveru has quit [Quit: Ping timeout (120 seconds)]
manveru has joined #ruby
A_Dragon has quit [Quit: ZNC - https://znc.in]
A_Dragon has joined #ruby
wyclif has joined #ruby
wyclif has quit [Ping timeout: 268 seconds]
ollysmith has quit [Quit: ZNC 1.8.2+deb4+b2 - https://znc.in]
ollysmith has joined #ruby
ollysmith has quit [Client Quit]
ollysmith has joined #ruby
donofrio has joined #ruby
wyclif has joined #ruby
wyclif has quit [Ping timeout: 245 seconds]
whysthatso125070 has joined #ruby
jenrzzz has quit [Ping timeout: 255 seconds]
wyclif has joined #ruby
piscium has joined #ruby
piscium has quit [Quit: Leaving]
wyclif has quit [Ping timeout: 260 seconds]
whysthatso125070 has quit [Read error: Connection reset by peer]
jenrzzz has joined #ruby
IBUXZiKvk has quit [Quit: zzz]
whysthatso125070 has joined #ruby
wyclif has joined #ruby
wyclif has quit [Ping timeout: 240 seconds]
whysthatso125070 has quit [Ping timeout: 268 seconds]
Guest5 has joined #ruby
whysthatso125070 has joined #ruby
donofrio_ has joined #ruby
donofrio__ has joined #ruby
donofrio has quit [Ping timeout: 256 seconds]
donofrio_ has quit [Ping timeout: 245 seconds]
wyclif has joined #ruby
wyclif has quit [Ping timeout: 246 seconds]
wyclif has joined #ruby
wyclif has quit [Ping timeout: 268 seconds]
wyclif has joined #ruby
wyclif has quit [Ping timeout: 245 seconds]
___nick___ has joined #ruby
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
wyclif has joined #ruby
wyclif has quit [Ping timeout: 260 seconds]
___nick___ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
___nick___ has joined #ruby
___nick___ has joined #ruby
wyclif has joined #ruby
wyclif has quit [Ping timeout: 255 seconds]
CrazyEddy has quit [Remote host closed the connection]
passbe has quit [Ping timeout: 245 seconds]
passbe has joined #ruby
wyclif has joined #ruby
wyclif has quit [Ping timeout: 245 seconds]
jvalleroy has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
jvalleroy has joined #ruby
srbaker has quit [Quit: srbaker]
jenrzzz has quit [Ping timeout: 256 seconds]
wyclif has joined #ruby
ken_barber has quit [Quit: Client closed]
wyclif has quit [Ping timeout: 268 seconds]
donofrio__ has quit [Remote host closed the connection]
hightower2 has joined #ruby
Aminda has quit [Remote host closed the connection]
Aminda has joined #ruby
gaussianblue has quit [Quit: leaving]
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
ken_barber has joined #ruby
wyclif has joined #ruby
jenrzzz has joined #ruby
wyclif has quit [Ping timeout: 252 seconds]
donofrio has joined #ruby
donofrio_ has joined #ruby
brokkoli_origin has quit [Ping timeout: 245 seconds]
donofrio has quit [Ping timeout: 255 seconds]
wyclif has joined #ruby
wyclif has quit [Ping timeout: 255 seconds]
Linux_Kerio has joined #ruby
wyclif has joined #ruby
brokkoli_origin has joined #ruby
Trivial has quit [Ping timeout: 260 seconds]
wyclif has quit [Ping timeout: 256 seconds]
ken_barber has quit [Quit: Client closed]
wyclif has joined #ruby
wyclif has quit [Ping timeout: 245 seconds]
_whitelogger has joined #ruby
howdoi has joined #ruby
havenwood has quit [Quit: The Lounge - https://thelounge.chat]
havenwood has joined #ruby
osc4rpt has quit [Ping timeout: 264 seconds]
osc4rpt has joined #ruby
wyclif has joined #ruby
jenrzzz has quit [Quit: Lost terminal]
joako has quit [Quit: quit]
dviola has quit [Ping timeout: 252 seconds]
r3m has quit [Quit: WeeChat 4.3.0-dev]
joako has joined #ruby
r3m has joined #ruby
<bastelfreak> autojoin add
<bastelfreak> autojoin add --run
___nick___ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
___nick___ has joined #ruby
___nick___ has quit [Client Quit]
___nick___ has joined #ruby
_ht has quit [Remote host closed the connection]
___nick___ has quit [Ping timeout: 268 seconds]
osc4rpt has quit [Ping timeout: 245 seconds]
osc4rpt has joined #ruby
Guest84 has joined #ruby
Guest84 has quit [Client Quit]
r3m has quit [Quit: WeeChat 4.3.0-dev]
jenrzzz has joined #ruby
r3m has joined #ruby
desnudopenguino1 has joined #ruby
desnudopenguino has quit [Ping timeout: 272 seconds]
desnudopenguino1 is now known as desnudopenguino
pascal_blaze has joined #ruby
c10l has quit [Remote host closed the connection]
c10l has joined #ruby
donofrio__ has joined #ruby
wyclif has quit [Ping timeout: 268 seconds]
donofrio_ has quit [Ping timeout: 255 seconds]
donofrio_ has joined #ruby
donofrio__ has quit [Ping timeout: 240 seconds]
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
wyclif has joined #ruby
wyclif has quit [Ping timeout: 272 seconds]
wyclif has joined #ruby
xdminsy has quit [Quit: Konversation terminated!]
xdminsy has joined #ruby
TomyLobo has joined #ruby
Linux_Kerio has quit [Ping timeout: 255 seconds]
wyclif has quit [Ping timeout: 268 seconds]
wyclif has joined #ruby
wyclif has quit [Ping timeout: 245 seconds]
jenrzzz has quit [Ping timeout: 252 seconds]
wyclif has joined #ruby
wyclif has quit [Ping timeout: 256 seconds]
wyclif has joined #ruby
wyclif has quit [Ping timeout: 252 seconds]