Skip to content

Commit 568a35e

Browse files
committed
Fix --quiet not stopping all output
Fixes #272
1 parent f8c76c3 commit 568a35e

File tree

7 files changed

+32
-5
lines changed

7 files changed

+32
-5
lines changed

corral/cmd/_test_cmd_update.pony

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ primitive _OpsRecorderTestRunner
9191
let log = StringLogger(Error, h.env.err, SimpleLogFormatter)
9292
let fp: FilePath = _TestData.file_path_from(h, dep_path)?
9393
let repo_cache = _TestRepoCache(auth)
94-
let ctx = Context(h.env, log, log, false, repo_cache)
94+
let ctx = Context(h.env, log, log, false, false, repo_cache)
9595
let project = Project(auth, log, fp)
9696
let bundle = Bundle.load(fp, log)?
9797
let vcs_builder: VCSBuilder = _TestCmdUpdateVCSBuilder(recorder)

corral/cmd/cmd_run.pony

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,10 @@ class CmdRun is CmdType
6666
end
6767
let a = Action(prog, recover args.slice(1) end, vars)
6868
if not ctx.nothing then
69-
Runner.run(a, {(result: ActionResult) =>
70-
result.print_to(ctx.env.out)
69+
Runner.run(a, {(result: ActionResult)(quiet = ctx.quiet) =>
70+
if not quiet then
71+
result.print_to(ctx.env.out)
72+
end
7173
if not result.successful() then
7274
ctx.env.exitcode(result.exit_code())
7375
end

corral/cmd/context.pony

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,20 @@ class val Context
99
let log: Logger[String]
1010
let uout: Logger[String]
1111
let nothing: Bool
12+
let quiet: Bool
1213
let repo_cache: FilePath
1314

1415
new val create(
1516
env': Env,
1617
log': Logger[String],
1718
uout': Logger[String],
1819
nothing': Bool,
20+
quiet': Bool,
1921
repo_cache': FilePath)
2022
=>
2123
env = env'
2224
log = log'
2325
uout = uout'
2426
nothing = nothing'
27+
quiet = quiet'
2528
repo_cache = repo_cache'

corral/cmd/executor.pony

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ primitive Executor
1616
log: Logger[String],
1717
uout: Logger[String],
1818
nothing: Bool,
19+
quiet: Bool,
1920
bundle_dir_arg: String)
2021
// TODO: add when we have the cli flag: repo_cache_str: String
2122
=>
@@ -89,7 +90,7 @@ primitive Executor
8990
return
9091
end
9192

92-
let context = Context(env, log, uout, nothing, repo_cache)
93+
let context = Context(env, log, uout, nothing, quiet, repo_cache)
9394
let project = Project(auth, log, bundle_dir)
9495
let vcs_builder = CorralVCSBuilder(env)
9596
command(context, project, vcs_builder, NoOpResultReceiver)

corral/main.pony

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ actor Main
5353
// Hand off to Executor to resolve required dirs and execute the command
5454
Executor.execute(
5555
command._1, env, log, command._2,
56-
cmd.option("nothing").bool(), cmd.option("bundle_dir").string())
56+
cmd.option("nothing").bool(), quiet, cmd.option("bundle_dir").string())
5757

5858
fun @runtime_override_defaults(rto: RuntimeOptions) =>
5959
rto.ponynoblock = true

corral/test/_test.pony

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ actor \nodoc\ Main is TestList
3030
test(integration.TestRunBinaryNotFound)
3131
test(integration.TestRunBinaryNotFoundAbsolute)
3232
test(integration.TestRunBinaryInParentFolder)
33+
test(integration.TestRunQuiet)
3334
test(integration.TestClean)
3435

3536
test(integration.TestUpdateScripts)

corral/test/integration/test_run.pony

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,26 @@ class \nodoc\ TestRunBinaryNotFoundAbsolute is UnitTest
8888
h.complete(ar.exit_code() != 0)
8989
})
9090

91+
class \nodoc\ TestRunQuiet is UnitTest
92+
fun name(): String => "integration/run/quiet"
93+
fun apply(h: TestHelper) ? =>
94+
h.long_test(30_000_000_000)
95+
Execute(h,
96+
recover [
97+
"--quiet"
98+
"run"
99+
"--bundle_dir"; Data(h, "empty-deps")?.path
100+
"--"
101+
"ponyc"; "-version"
102+
] end,
103+
{(h: TestHelper, ar: ActionResult) =>
104+
h.assert_eq[I32](0, ar.exit_code())
105+
h.assert_false(ar.stdout.contains("exit:"))
106+
h.assert_false(ar.stdout.contains("out:"))
107+
h.assert_false(ar.stdout.contains("err:"))
108+
h.complete(ar.exit_code() == 0)
109+
})
110+
91111
class \nodoc\ TestRunBinaryInParentFolder is UnitTest
92112
fun name(): String => "integration/run/binary-in-parent-folder"
93113
fun apply(h: TestHelper) ? =>

0 commit comments

Comments
 (0)