@@ -2463,23 +2463,40 @@ def run_cqlsh_catch_toolerror(cmd, env):
2463
2463
"""
2464
2464
run_cqlsh will throw ToolError if cqlsh exits with a non-zero exit code.
2465
2465
"""
2466
+ out = ""
2467
+ err = ""
2466
2468
try :
2467
2469
out , err , _ = self .node1 .run_cqlsh (cmd , env )
2468
2470
except ToolError as e :
2469
2471
return e .stdout , e .stderr
2472
+ return out , err
2470
2473
2471
- cqlsh_stdout , cqlsh_stderr , = run_cqlsh_catch_toolerror ('COPY foo.bar FROM \' blah\' ;' , ['--no-file-io' ])
2474
+ create_ks (self .session , 'foo' , rf = 1 )
2475
+ create_cf (self .session , 'bar' , key_type = 'int' , columns = {'name' : 'text' })
2476
+
2477
+ cqlsh_stdout , cqlsh_stderr , _ = self .node1 .run_cqlsh ('COPY foo.bar TO \' /dev/null\' ;' , [])
2478
+ assert '0 rows exported to 1 files' in cqlsh_stdout
2479
+ assert cqlsh_stderr == ''
2480
+ cqlsh_stdout , cqlsh_stderr = run_cqlsh_catch_toolerror ('COPY foo.bar TO \' /dev/null\' ;' , ['--no-file-io' ])
2472
2481
assert cqlsh_stdout == ''
2473
2482
assert 'No file I/O permitted' in cqlsh_stderr
2474
2483
2484
+ cqlsh_stdout , cqlsh_stderr = run_cqlsh_catch_toolerror ('DEBUG' , [])
2485
+ assert '(Pdb)' in cqlsh_stdout
2475
2486
cqlsh_stdout , cqlsh_stderr = run_cqlsh_catch_toolerror ('DEBUG' , ['--no-file-io' ])
2476
2487
assert cqlsh_stdout == ''
2477
2488
assert 'No file I/O permitted' in cqlsh_stderr
2478
2489
2490
+ cqlsh_stdout , cqlsh_stderr = run_cqlsh_catch_toolerror ('CAPTURE \' nah\' ' , [])
2491
+ assert cqlsh_stdout == 'Now capturing query output to \' nah\' .\n '
2492
+ assert cqlsh_stderr == ''
2479
2493
cqlsh_stdout , cqlsh_stderr = run_cqlsh_catch_toolerror ('CAPTURE \' nah\' ' , ['--no-file-io' ])
2480
2494
assert cqlsh_stdout == ''
2481
2495
assert 'No file I/O permitted' in cqlsh_stderr
2482
2496
2497
+ cqlsh_stdout , cqlsh_stderr = run_cqlsh_catch_toolerror ('SOURCE \' nah\' ' , [])
2498
+ assert cqlsh_stdout == ''
2499
+ assert cqlsh_stderr == ''
2483
2500
cqlsh_stdout , cqlsh_stderr = run_cqlsh_catch_toolerror ('SOURCE \' nah\' ' , ['--no-file-io' ])
2484
2501
assert cqlsh_stdout == ''
2485
2502
assert 'No file I/O permitted' in cqlsh_stderr
0 commit comments