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

616 print image process list in nice formatted way #617

Conversation

Bajger
Copy link
Member

@Bajger Bajger commented May 18, 2023

fixes #616

@Bajger Bajger self-assigned this May 18, 2023
@Bajger Bajger added the cmd-line Command-line Launcher issue label May 18, 2023
@Bajger Bajger linked an issue May 18, 2023 that may be closed by this pull request
@Bajger
Copy link
Member Author

Bajger commented May 18, 2023

Will add unit tests in additional commit

@Bajger Bajger requested a review from demarey June 21, 2023 10:16
@demarey demarey force-pushed the feature/cmd-line branch 7 times, most recently from 6744620 to 12a48b1 Compare August 28, 2023 14:56
@Bajger Bajger requested a review from demarey September 22, 2023 13:26
@Bajger
Copy link
Member Author

Bajger commented Sep 22, 2023

@demarey Hi Christophe! Finally had chance to provide needed changes. Please take a look!

@Bajger
Copy link
Member Author

Bajger commented Sep 22, 2023

Found the issue in parsing line with process information. I didn't test it with pharo processes that run with --headless parameter (or other vm or image params). Therefore parsing is shifted.

@Bajger
Copy link
Member Author

Bajger commented Feb 2, 2024

@demarey Please take a look. Process list identification should be robust enough now, I hope I found all cornercases for pgrep. Should be working both on Linux and MacOS (tested).

  • I will squash commit and merge to feature/cmd-line
  • then cherrypick to dev branch and move fiunctionality to PhLProcessListCliCommand (via new PR)?

Note: There was a funny problem which I could not identify, since pgrep returns exitCode 1 in case of no process match. This resulted in exception in OS Shell command execution in Pharo - since exitSuccess is tested there. Lessons learned (read man pages) :-)

@demarey
Copy link
Contributor

demarey commented Feb 2, 2024

I did a local merge with dev branch and running tests.
I see a problem with date convertion:

OS process command: '/bin/zsh -c ps -o lstart= -p "1974" | xargs -I{} date -jf "%a %b %e %T %Y" "{}" '+%Y-%m-%d %H:%M:%S''  exited with: normal termination with status 1.
Stderr contents: "Failed conversion of ``Lun 29 jan 12:34:40 2024'' using format ``%a %b %e %T %Y''
date: illegal time format
usage: date [-jnRu] [-I[date|hours|minutes|seconds]] [-f input_fmt]
            [-r filename|seconds] [-v[+|-]val[y|m|w|d|H|M|S]]
            [[[[mm]dd]HH]MM[[cc]yy][.SS] | new_date] [+output_fmt]
".

@Bajger
Copy link
Member Author

Bajger commented Feb 2, 2024

Lun 29 jan 12:34:40 2024
This is date in French localization? I will test with it.

@demarey
Copy link
Contributor

demarey commented Feb 2, 2024

Lun 29 jan 12:34:40 2024
This is date in French localization? I will test with it.

Yes. And maybe there could be other issues with otherlocalizations. Maybe there is a way to use an ISO format ?

@Bajger
Copy link
Member Author

Bajger commented Feb 2, 2024

@demarey: Please try now.

@demarey
Copy link
Contributor

demarey commented Feb 2, 2024

@demarey: Please try now.

Not yet

OS process command: '/bin/zsh -c LANG=C ps -o lstart= -p "1974" | xargs -I{} date -jf "%a %b %e %T %Y" "{}" '+%Y-%m-%d %H:%M:%S''  exited with: normal termination with status 1.
Stderr contents: "Failed conversion of ``Mon Jan 29 12:34:40 2024'' using format ``%a %b %e %T %Y''
date: illegal time format
usage: date [-jnRu] [-I[date|hours|minutes|seconds]] [-f input_fmt]
            [-r filename|seconds] [-v[+|-]val[y|m|w|d|H|M|S]]
            [[[[mm]dd]HH]MM[[cc]yy][.SS] | new_date] [+output_fmt]
".

@Bajger
Copy link
Member Author

Bajger commented Feb 2, 2024

This is strange, if I evaluate on my MacOS:

dbajger@Davids-MacBook-Pro P11-launcher-dev % LANG=C ps -o lstart= -p 50442 | xargs -I{} date -jf "%a %b %e %T %Y" "{}" '+%Y-%m-%d %H:%M:%S' 
2024-01-31 09:07:55

So on my computer works. I don't know. Date formatting to ISO is really clumsy.

@demarey
Copy link
Contributor

demarey commented Feb 2, 2024

after investigation the command that works on my mac is:
date -j -u -f "%a %d %b %H:%M:%S %Y" '+%Y-%m-%d %H:%M:%S' "Lun 29 jan 12:26:05 2024"

@Bajger
Copy link
Member Author

Bajger commented Feb 5, 2024

@demarey Tested on my Mac with adopted time attributes (571fa76) . Please let me know!

@demarey
Copy link
Contributor

demarey commented Feb 5, 2024

@Bajger Did you see my PR on this topic on your repository?

@Bajger
Copy link
Member Author

Bajger commented Feb 5, 2024

@Bajger Did you see my PR on this topic on your repository?

Hi @demarey ! Sorry I didn't recognize that. To resolve conflicts, I need to checkout my branch or https://github.com/pharo-project/pharo-launcher/tree/enh/PR616 ?

GitHub
Lets you manage your pharo images and download new ones - GitHub - pharo-project/pharo-launcher at enh/PR616

@demarey
Copy link
Contributor

demarey commented Feb 5, 2024

Hi @demarey ! Sorry I didn't recognize that. To resolve conflicts, I need to checkout my branch or https://github.com/pharo-project/pharo-launcher/tree/enh/PR616 ?

I just diid the merge. The PR is up to date

GitHub
Lets you manage your pharo images and download new ones - GitHub - pharo-project/pharo-launcher at enh/PR616

refactor PhLImageProcess creation and fix date conversion (from ps) on mac os
@demarey demarey merged commit a5334e6 into pharo-project:feature/cmd-line Feb 5, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmd-line Command-line Launcher issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Print image process list in nice formatted way
3 participants