Skip to content

Check os.FileMode#7

Merged
tkuchiki merged 1 commit intotkuchiki:mainfrom
kitagry:fix-on-linux
Aug 17, 2022
Merged

Check os.FileMode#7
tkuchiki merged 1 commit intotkuchiki:mainfrom
kitagry:fix-on-linux

Conversation

@kitagry
Copy link
Contributor

@kitagry kitagry commented Aug 17, 2022

Hi @tkuchiki ! Thank you for the nice plugin.

I think Stdin.Size() method return 0 on at least my OS. And, Documents says length in bytes for regular files; system-dependent for others. I fixed to check os.FileMode.

My Environment

$ uname -a
Linux archxps 5.18.1-arch1-1 #1 SMP PREEMPT_DYNAMIC Mon, 30 May 2022 17:53:11 +0000 x86_64 GNU/Linux

Expected

$ cat /var/og/mysql/slow-query.log | slp
+-------+----------------------------------------------------------------------+----------------+----------------+----------------+----------------+
| COUNT |                                QUERY                                 | MIN(QUERYTIME) | MAX(QUERYTIME) | SUM(QUERYTIME) | AVG(QUERYTIME) |
+-------+----------------------------------------------------------------------+----------------+----------------+----------------+----------------+
| 1     | DELETE FROM `haveread`                                               | 0.000532       | 0.000532       | 0.000532       | 0.000532       |
| 1     | SELECT @@`version_comment`                                           | 0.000203       | 0.000203       | 0.000203       | 0.000203       |
+-------+----------------------------------------------------------------------+----------------+----------------+----------------+----------------+

Actual

$ cat /var/og/mysql/slow-query.log | slp
Usage:
  slp [flags]
  slp [command]

Available Commands:
  completion           Generate the autocompletion script for the specified shell
  diff                 Show the difference between the two profile results
  help                 Help about any command
  print-output-options Print --output options

Flags:
      --bundle-values            Bundle VALUES of INSERT statement
      --bundle-where-in          Bundle WHERE IN conditions
      --config string            The configuration file
      --dump string              Dump profiled data as YAML
      --file string              The slowlog file
  -f, --filters string           Only the logs are profiled that match the conditions
      --format string            The output format (table, markdown, tsv, csv and html) (default "table")
  -h, --help                     help for slp
      --limit int                The maximum number of results to display (default 5000)
      --load string              Load the profiled YAML data
  -m, --matching-groups string   Specifies Query matching groups separated by commas
  -a, --noabstract               Do not abstract all numbers to N and strings to 'S'
      --noheaders                Output no header line at all (only --format=tsv, csv)
      --nosave-pos               Do not save position file
  -o, --output string            Specifies the results to display, separated by commas (default "simple")
      --page int                 Number of pages of pagination (default 100)
      --percentiles string       Specifies the percentiles separated by commas
      --pos string               The position file
  -r, --reverse                  Sort results in reverse order
      --show-footers             Output footer line at all (only --format=table, markdown)
      --sort string              Output the results in sorted order (default "count")

@kitagry kitagry changed the title Fix command for linux Check os.FileMode Aug 17, 2022
@tkuchiki
Copy link
Owner

Thank you very much, LGTM!

@tkuchiki tkuchiki merged commit e32a6cf into tkuchiki:main Aug 17, 2022
@kitagry
Copy link
Contributor Author

kitagry commented Aug 17, 2022

Thank you for the quick response!

@kitagry kitagry deleted the fix-on-linux branch August 17, 2022 12:46
@tkuchiki
Copy link
Owner

@kitagry
Copy link
Contributor Author

kitagry commented Aug 17, 2022

Thank you! 😄

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