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

avoid using awk in shared specs #921

Merged
merged 1 commit into from
Jan 26, 2023
Merged

avoid using awk in shared specs #921

merged 1 commit into from
Jan 26, 2023

Conversation

dunn
Copy link
Collaborator

@dunn dunn commented Jan 25, 2023

in some contexts(?) awk can fail to filter results correctly:

[3] pry(RSpec::Support::AllExceptionsExceptOnesWeMustNotRescue)> `lsof +D . | awk '{print $9}'` => "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" [4] 

pry(RSpec::Support::AllExceptionsExceptOnesWeMustNotRescue)> `lsof +D .` => "1\t/usr/local/bin/ruby\t0\t/dev/pts/0\n1\t/usr/local/bin/ruby\t1\t/dev/pts/0\n1\t/usr/local/bin/ruby\t2\t/dev/pts/0\n1\t/usr/local/bin/ruby\t3\tanon_inode:[eventfd]\n1\t/usr/local/bin/ruby\t4\tanon_inode:[eventfd]\n1\t/usr/local/bin/ruby\t5\tpipe:[39924]\n1\t/usr/local/bin/ruby\t6\tpipe:[39924]\n1\t/usr/local/bin/ruby\t7\t/app/samvera/hyrax-engine/config/metadata/core_metadata.yaml\n1\t/usr/local/bin/ruby\t8\tanon_inode:inotify\n1\t/usr/local/bin/ruby\t9\tpipe:[39922]\n1\t/usr/local/bin/ruby\t10\tpipe:[39922]\n1\t/usr/local/bin/ruby\t11\tanon_inode:inotify\n1\t/usr/local/bin/ruby\t12\tsocket:[40809]\n1\t/usr/local/bin/ruby\t13\tpipe:[39925]\n1\t/usr/local/bin/ruby\t14\tpipe:[39925]\n1\t/usr/local/bin/ruby\t15\tpipe:[39926]\n1\t/usr/local/bin/ruby\t16\tpipe:[39926]\n1\t/usr/local/bin/ruby\t17\tanon_inode:[eventpoll]\n1\t/usr/local/bin/ruby\t18\tpipe:[39927]\n1\t/usr/local/bin/ruby\t19\tpipe:[39927]\n448\t/bin/busybox\t0\t/dev/pts/1\n448\t/bin/busybox\t1\t/dev/pts/1\n448\t/bin/busybox\t2\t/dev/pts/1\n448\t/bin/busybox\t10\t/dev/tty\n717\t/usr/local/bin/ruby\t0\t/dev/pts/2\n717\t/usr/local/bin/ruby\t1\t/dev/pts/2\n717\t/usr/local/bin/ruby\t2\t/dev/pts/2\n717\t/usr/local/bin/ruby\t3\tanon_inode:[eventfd]\n717\t/usr/local/bin/ruby\t4\tanon_inode:[eventfd]\n717\t/usr/local/bin/ruby\t5\t/app/samvera/hyrax-webapp/log/test.log\n717\t/usr/local/bin/ruby\t6\tsocket:[59017]\n717\t/usr/local/bin/ruby\t7\tsocket:[59019]\n717\t/usr/local/bin/ruby\t8\t/tmp/temp_io20230125-717-1ti353m\n717\t/usr/local/bin/ruby\t9\t/root/.local/share/pry/pry_history\n717\t/usr/local/bin/ruby\t10\tpipe:[60736]\n"

in some contexts(?) awk can fail to filter results correctly:

[3] pry(RSpec::Support::AllExceptionsExceptOnesWeMustNotRescue)> `lsof +D . | awk '{print $9}'`
=> "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
[4] pry(RSpec::Support::AllExceptionsExceptOnesWeMustNotRescue)> `lsof +D .`
=> "1\t/usr/local/bin/ruby\t0\t/dev/pts/0\n1\t/usr/local/bin/ruby\t1\t/dev/pts/0\n1\t/usr/local/bin/ruby\t2\t/dev/pts/0\n1\t/usr/local/bin/ruby\t3\tanon_inode:[eventfd]\n1\t/usr/local/bin/ruby\t4\tanon_inode:[eventfd]\n1\t/usr/local/bin/ruby\t5\tpipe:[39924]\n1\t/usr/local/bin/ruby\t6\tpipe:[39924]\n1\t/usr/local/bin/ruby\t7\t/app/samvera/hyrax-engine/config/metadata/core_metadata.yaml\n1\t/usr/local/bin/ruby\t8\tanon_inode:inotify\n1\t/usr/local/bin/ruby\t9\tpipe:[39922]\n1\t/usr/local/bin/ruby\t10\tpipe:[39922]\n1\t/usr/local/bin/ruby\t11\tanon_inode:inotify\n1\t/usr/local/bin/ruby\t12\tsocket:[40809]\n1\t/usr/local/bin/ruby\t13\tpipe:[39925]\n1\t/usr/local/bin/ruby\t14\tpipe:[39925]\n1\t/usr/local/bin/ruby\t15\tpipe:[39926]\n1\t/usr/local/bin/ruby\t16\tpipe:[39926]\n1\t/usr/local/bin/ruby\t17\tanon_inode:[eventpoll]\n1\t/usr/local/bin/ruby\t18\tpipe:[39927]\n1\t/usr/local/bin/ruby\t19\tpipe:[39927]\n448\t/bin/busybox\t0\t/dev/pts/1\n448\t/bin/busybox\t1\t/dev/pts/1\n448\t/bin/busybox\t2\t/dev/pts/1\n448\t/bin/busybox\t10\t/dev/tty\n717\t/usr/local/bin/ruby\t0\t/dev/pts/2\n717\t/usr/local/bin/ruby\t1\t/dev/pts/2\n717\t/usr/local/bin/ruby\t2\t/dev/pts/2\n717\t/usr/local/bin/ruby\t3\tanon_inode:[eventfd]\n717\t/usr/local/bin/ruby\t4\tanon_inode:[eventfd]\n717\t/usr/local/bin/ruby\t5\t/app/samvera/hyrax-webapp/log/test.log\n717\t/usr/local/bin/ruby\t6\tsocket:[59017]\n717\t/usr/local/bin/ruby\t7\tsocket:[59019]\n717\t/usr/local/bin/ruby\t8\t/tmp/temp_io20230125-717-1ti353m\n717\t/usr/local/bin/ruby\t9\t/root/.local/share/pry/pry_history\n717\t/usr/local/bin/ruby\t10\tpipe:[60736]\n"
@dunn dunn requested a review from tpendragon January 25, 2023 23:41
@dunn dunn merged commit 9a3225f into main Jan 26, 2023
@dunn dunn deleted the storage-spec-lsof branch January 26, 2023 00:23
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.

2 participants