@@ -384,7 +384,7 @@ defmodule Mix.Tasks.Workspace.RunTest do
384384 "--env-var" ,
385385 "FOO=bar" ,
386386 "--" ,
387- "--shell" ,
387+ maybe_shell ( ) ,
388388 "echo" ,
389389 "$FOO"
390390 ]
@@ -396,9 +396,9 @@ defmodule Mix.Tasks.Workspace.RunTest do
396396
397397 assert_cli_output_match ( captured , [
398398 "Running task in 1 workspace projects" ,
399- "==> :package_a - mix cmd --shell echo $FOO" ,
399+ ~r " ==> :package_a - mix cmd(?: --shell)? \s + echo \ $ FOO" ,
400400 "bar" ,
401- ":package_a mix cmd --shell echo $FOO succeeded ["
401+ ~r " :package_a mix cmd(?: --shell)? \s + echo \ $ FOO succeeded \ ["
402402 ] )
403403
404404 assert System . get_env ( "FOO" ) == nil
@@ -418,7 +418,7 @@ defmodule Mix.Tasks.Workspace.RunTest do
418418 "--workspace-path" ,
419419 tmp_dir ,
420420 "--" ,
421- "--shell" ,
421+ maybe_shell ( ) ,
422422 "exit" ,
423423 "1"
424424 ]
@@ -436,12 +436,12 @@ defmodule Mix.Tasks.Workspace.RunTest do
436436 assert_cli_output_match (
437437 captured ,
438438 [
439- "==> :package_a - mix cmd --shell exit 1" ,
439+ ~r " ==> :package_a - mix cmd(?: --shell)? \s + exit 1" ,
440440 "** (exit) 1" ,
441- ":package_a mix cmd --shell exit 1 failed with 1" ,
442- "==> :package_b - mix cmd --shell exit 1" ,
441+ ~r " :package_a mix cmd(?: --shell)? \s + exit 1 failed with 1" ,
442+ ~r " ==> :package_b - mix cmd(?: --shell)? \s + exit 1" ,
443443 "** (exit) 1" ,
444- ":package_b mix cmd --shell exit 1 failed with 1"
444+ ~r " :package_b mix cmd(?: --shell)? \s + exit 1 failed with 1"
445445 ] ,
446446 partial: true
447447 )
@@ -462,7 +462,7 @@ defmodule Mix.Tasks.Workspace.RunTest do
462462 "--workspace-path" ,
463463 tmp_dir ,
464464 "--" ,
465- "--shell" ,
465+ maybe_shell ( ) ,
466466 "exit" ,
467467 "1"
468468 ]
@@ -477,16 +477,16 @@ defmodule Mix.Tasks.Workspace.RunTest do
477477 assert_cli_output_match (
478478 captured ,
479479 [
480- "==> :package_a - mix cmd --shell exit 1" ,
480+ ~r " ==> :package_a - mix cmd(?: --shell)? \s + exit 1" ,
481481 "** (exit) 1" ,
482- ":package_a mix cmd --shell exit 1 failed with 1"
482+ ~r " :package_a mix cmd(?: --shell)? \s + exit 1 failed with 1"
483483 ] ,
484484 partial: true
485485 )
486486
487487 refute_cli_output_match ( captured , [
488- "==> :package_b - mix cmd --shell exit 1" ,
489- ":package_b mix cmd --shell exit 1 failed with 1"
488+ ~r " ==> :package_b - mix cmd(?: --shell)? \s + exit 1" ,
489+ ~r " :package_b mix cmd(?: --shell)? \s + exit 1 failed with 1"
490490 ] )
491491 end )
492492 end
@@ -505,7 +505,7 @@ defmodule Mix.Tasks.Workspace.RunTest do
505505 "--workspace-path" ,
506506 tmp_dir ,
507507 "--" ,
508- "--shell" ,
508+ maybe_shell ( ) ,
509509 "exit" ,
510510 "0"
511511 ]
@@ -515,8 +515,8 @@ defmodule Mix.Tasks.Workspace.RunTest do
515515 assert_cli_output_match (
516516 captured ,
517517 [
518- "==> :package_a - mix cmd --shell exit 0" ,
519- "==> :package_b - mix cmd --shell exit 0"
518+ ~r " ==> :package_a - mix cmd(?: --shell)? \s + exit 0" ,
519+ ~r " ==> :package_b - mix cmd(?: --shell)? \s + exit 0"
520520 ] ,
521521 partial: true
522522 )
@@ -540,7 +540,7 @@ defmodule Mix.Tasks.Workspace.RunTest do
540540 "--workspace-path" ,
541541 tmp_dir ,
542542 "--" ,
543- "--shell" ,
543+ maybe_shell ( ) ,
544544 "exit" ,
545545 "1"
546546 ]
@@ -553,12 +553,12 @@ defmodule Mix.Tasks.Workspace.RunTest do
553553 assert_cli_output_match (
554554 captured ,
555555 [
556- "==> :package_a - mix cmd --shell exit 1" ,
556+ ~r " ==> :package_a - mix cmd(?: --shell)? \s + exit 1" ,
557557 "** (exit) 1" ,
558- ":package_a mix cmd --shell exit 1 failed with 1" ,
559- "==> :package_b - mix cmd --shell exit 1" ,
558+ ~r " :package_a mix cmd(?: --shell)? \s + exit 1 failed with 1" ,
559+ ~r " ==> :package_b - mix cmd(?: --shell)? \s + exit 1" ,
560560 "** (exit) 1" ,
561- ":package_b mix cmd --shell exit 1 failed with 1" ,
561+ ~r " :package_b mix cmd(?: --shell)? \s + exit 1 failed with 1" ,
562562 "WARNING task failed in 2 projects but the --alow-failure flag is set" ,
563563 "failed projects - [:package_a, :package_b]"
564564 ] ,
@@ -750,7 +750,7 @@ defmodule Mix.Tasks.Workspace.RunTest do
750750 "--export" ,
751751 output_file ,
752752 "--" ,
753- "--shell" ,
753+ maybe_shell ( ) ,
754754 "echo \" Hello\n world\" "
755755 ] )
756756 end )
@@ -767,4 +767,12 @@ defmodule Mix.Tasks.Workspace.RunTest do
767767 end
768768 )
769769 end
770+
771+ defp maybe_shell do
772+ if System . version ( ) |> String . starts_with? ( "1.19" ) do
773+ "--shell"
774+ else
775+ ""
776+ end
777+ end
770778end
0 commit comments