Skip to content

Conversation

yashi
Copy link
Contributor

@yashi yashi commented Sep 30, 2022

This PR is to add a new option -o outfile.

While adding it, I found that meson is generating a warning about run_command. This PR includes a small fix for that as well.

yashi added 2 commits October 1, 2022 00:51
Newer Meson warns about default behavior of run_command.

   WARNING: You should add the boolean check kwarg to the run_command call.
            It currently defaults to false,
            but it will default to true in future releases of meson.
            See also: mesonbuild/meson#9300

This commit explicitly adds the current default value, false, to the
check argument.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Add a new option to specify output file.  This is useful when the
command is not run from a shell and redirect '>' is not an option.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
@jpmens
Copy link
Owner

jpmens commented Sep 30, 2022

Thank you for your submission!

Can you tell us why you feel this option is necessary instead of, say, using output redirection?

@yashi
Copy link
Contributor Author

yashi commented Sep 30, 2022

Hi,

Thank you for a nice tool!

As I wrote in a commit message some tools exec without shell, such as CMake in my case. without any shell, you can't use redirection, '>', to create a file.
https://cmake.org/cmake/help/latest/command/execute_process.html#execute-process

@jpmens
Copy link
Owner

jpmens commented Sep 30, 2022

I missed the commit message, sorry, and thank you for the explanation.

@jpmens jpmens merged commit d972f29 into jpmens:master Sep 30, 2022
@jpmens
Copy link
Owner

jpmens commented Sep 30, 2022

Merged, thanks!

@yashi yashi deleted the add-option-o branch September 30, 2022 16:40
@@ -56,7 +56,8 @@ jo1 = custom_target('jo.1',
command: [pandoc_commands, '@OUTPUT@', '@INPUT@']).full_path()
run_command(pandoc_commands,
join_paths(meson.current_build_dir(), 'jo.1'),
join_paths(meson.current_source_dir(), 'jo.pandoc'))
join_paths(meson.current_source_dir(), 'jo.pandoc'),
check: false)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The point of Meson adding the warning was specifically to make people consider whether they need to check the return value, so choosing "false" based purely on it being the old default seems wrong.

Let's instead look at the command in question and ponder: do we need to check this?

What happens if the pandoc command totally fails? Should this be an error? Probably.

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.

3 participants