Capture YAD combobox output as variable..?

interpretive language scripts


Moderator: Forum moderators

User avatar
fredx181
Posts: 2997
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 364 times
Been thanked: 1272 times
Contact:

Re: Capture YAD combobox output as variable..?

Post by fredx181 »

Hi stemsee,

I think it is not necesssary to spawn a new instance of yad ... just send to pipe!

Yes, better.

Also when stopping the test and clearing the data info then I feel that I normally like to scrutinize the data. So now I must watch the test as it happens and process it in real time. Personally I prefer to review it after stopping and clear manually. Maybe the quit button could do the clearing first, before actually quitting, instead of stop test. Maybe a trap function also to clear /tmp/clear.sh ...

I too am not really liking the clear data when stopping, indeed letting the quit button to do the clearing is better, I don't know how yet.

Fred

User avatar
stemsee
Posts: 759
Joined: Sun Jul 26, 2020 8:11 am
Location: lattitude 8
Has thanked: 184 times
Been thanked: 126 times

Re: Capture YAD combobox output as variable..?

Post by stemsee »

I think the problem is with the pipe somehow being blocked up with the suspended dd command, maybe the pipe needs flushin/releasing first.

User avatar
fredx181
Posts: 2997
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 364 times
Been thanked: 1272 times
Contact:

Re: Capture YAD combobox output as variable..?

Post by fredx181 »

Found solution!
The kill dd command needs to be: kill -SIGINT, this way it quits okay without needing to clear data with the stop button.
Also implemented your suggestion about writing the message "please mount .." to the pipe

DriveSpeed-v4-fixed.tar.gz
(1.53 KiB) Downloaded 57 times
User avatar
stemsee
Posts: 759
Joined: Sun Jul 26, 2020 8:11 am
Location: lattitude 8
Has thanked: 184 times
Been thanked: 126 times

Re: Capture YAD combobox output as variable..?

Post by stemsee »

I tried signum and sigspec, kill `pgrep -n dd` etc etc ...

Good job :thumbup2:

EDIT: func_stop didn't do anything to stop the test. I had to change the command to

Code: Select all

kill -SIGINT `pgrep -n dd`
User avatar
fredx181
Posts: 2997
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 364 times
Been thanked: 1272 times
Contact:

Re: Capture YAD combobox output as variable..?

Post by fredx181 »

stemsee wrote: Fri May 07, 2021 6:23 pm

I tried signum and sigspec, kill `pgrep -n dd` etc etc ...

Good job :thumbup2:

EDIT: func_stop didn't do anything to stop the test. I had to change the command to

Code: Select all

kill -SIGINT `pgrep -n dd`

Strange, stop works for me, is ps different on your system perhaps, I never like "killall" (as you had previously in your v4) is `pgrep -n dd` similar i.e. does it kill all possibly existing dd processes ?
EDIT: I tested on FatDog (which I think you use) and stop worked for me.

User avatar
stemsee
Posts: 759
Joined: Sun Jul 26, 2020 8:11 am
Location: lattitude 8
Has thanked: 184 times
Been thanked: 126 times

Re: Capture YAD combobox output as variable..?

Post by stemsee »

Maybe i need to reboot system and test.

pgrep -n "command" gets pid of the newest instance, not all, so the last started instance is identified.

I also use fossadog cinnamon!.

EDIT: yeah its working!

User avatar
mikewalsh
Moderator
Posts: 6115
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 779 times
Been thanked: 1952 times

Re: Capture YAD combobox output as variable..?

Post by mikewalsh »

@fredx181 :-

I've had a quick squizz at the newest re-write of the v4 script, Fred; appears to work fine now. I'll probably re-pack it tomorrow; haven't got time tonight.

I'm intending to leave the v4 .pet & portable attached to the first post, along with a 'tidied-up' release of v2-portable....which a few others, including me, seem to prefer! So; the older version for those who like it, and the current version, for those who like all the bells & whistles.....which should, I think, cater for everyone.

One small point; I notice you now can't drag the bottom of the window down to 'expose' more of the progress display; was this intentional, or a 'side-effect' of summat else? :D

Mike. ;)

User avatar
bigpup
Moderator
Posts: 6929
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 895 times
Been thanked: 1508 times

Re: Capture YAD combobox output as variable..?

Post by bigpup »

DriveSpeed-v4-fixed.tar.gz

Are you sure the clr buffers is working?

After I make a test file, clr buffers, and try to read.
It seems to me it is reading what is in the buffers.

The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

User avatar
fredx181
Posts: 2997
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 364 times
Been thanked: 1272 times
Contact:

Re: Capture YAD combobox output as variable..?

Post by fredx181 »

bigpup wrote: Fri May 07, 2021 11:47 pm

DriveSpeed-v4-fixed.tar.gz

Are you sure the clr buffers is working?

After I make a test file, clr buffers, and try to read.
It seems to me it is reading what is in the buffers.

Maybe you are running it as standalone ?, clear buffers depends on the DATA/clear_cache script from Mike's setup, so you need to run 'DriveSpeed' from "DriveSpeed_v4-portable" folder.

@mikewalsh
One more thing and then I stop my obsessive behaviour with this :D
To stop the test I had a bit of a struggle to make it kill exclusively the dd command ran by the program (e.g. "killall dd" will kill all existing dd processes, so not an option).
func_stop improved: (how it was it could kill any command running at the same time with "/testfile" in it, small chance, I know, but still...):

Code: Select all

func_stop () {
# kill -SIGINT "$(ps -eo pid,cmd | grep '/testfile' | grep -v grep | awk '{ print $1 }')"
# kill dd pid (read or write)
kill -SIGINT "$(ps -eo pid,cmd | grep 'dd if=/dev/zero of=.*/testfile\|dd if=.*/testfile of=/dev/null' | grep -v grep | awk '{ print $1 }')"

}; export -f func_stop

One small point; I notice you now can't drag the bottom of the window down to 'expose' more of the progress display; was this intentional, or a 'side-effect' of summat else?

Mmm.. works ok for me, maybe behavior is a bit different because I've set width and height, needed for displaying properly when using yad gtk3.

Fred

Post Reply

Return to “Scripts”