diff --git a/src/cli/info.rs b/src/cli/info.rs index 9222baea32..c74d3c89f0 100644 --- a/src/cli/info.rs +++ b/src/cli/info.rs @@ -412,7 +412,7 @@ pub async fn execute(args: Args) -> miette::Result<()> { .iter() .map(|env| { let tasks = env - .tasks(None) + .tasks(Some(env.best_platform())) .ok() .map(|t| t.into_keys().cloned().collect()) .unwrap_or_default(); diff --git a/src/workspace/environment.rs b/src/workspace/environment.rs index 026917e032..0d7c6d383d 100644 --- a/src/workspace/environment.rs +++ b/src/workspace/environment.rs @@ -182,7 +182,7 @@ impl<'p> Environment<'p> { pub fn tasks( &self, platform: Option, - ) -> Result, UnsupportedPlatformError> { + ) -> Result, UnsupportedPlatformError> { self.validate_platform_support(platform)?; let result = self .features() diff --git a/tests/integration_python/test_main_cli.py b/tests/integration_python/test_main_cli.py index 2594f83336..bbbcc72fd4 100644 --- a/tests/integration_python/test_main_cli.py +++ b/tests/integration_python/test_main_cli.py @@ -1157,3 +1157,24 @@ def test_dont_error_on_missing_platform(pixi: Path, tmp_pixi_workspace: Path) -> [pixi, "install", "--manifest-path", manifest], stderr_contains=["pixi project platform add zos-z"], ) + + +def test_pixi_info_tasks(pixi: Path, tmp_pixi_workspace: Path) -> None: + manifest = tmp_pixi_workspace.joinpath("pixi.toml") + toml = """ + [workspace] + name = "test" + channels = [] + platforms = ["linux-64", "win-64", "osx-64"] + + [tasks] + foo = "echo foo" + + [target.unix.tasks] + bar = "echo bar" + + [target.win.tasks] + bar = "echo bar" + """ + manifest.write_text(toml) + verify_cli_command([pixi, "info", "--manifest-path", manifest], stdout_contains="foo, bar")