Initial project import
This commit is contained in:
commit
23f2d29e32
11957 files changed
+1754577
No files matched your search
@@ -0,0 +1,32 @@
|
||||
import os
|
||||
|
||||
fn test_command() {
|
||||
if os.user_os() == 'windows' {
|
||||
eprintln('>>> skipping command test on windows')
|
||||
return
|
||||
}
|
||||
|
||||
mut cmd := os.start_new_command('ls')!
|
||||
for !cmd.eof {
|
||||
line := cmd.read_line()
|
||||
if line == '' {
|
||||
continue
|
||||
}
|
||||
dump(line)
|
||||
}
|
||||
cmd.close()!
|
||||
assert cmd.exit_code == 0
|
||||
|
||||
eprintln('-------------------------')
|
||||
// This will return a non 0 code
|
||||
mut cmd_to_fail := os.start_new_command('ls -M')!
|
||||
for !cmd_to_fail.eof {
|
||||
line := cmd_to_fail.read_line()
|
||||
if line == '' {
|
||||
continue
|
||||
}
|
||||
dump(line)
|
||||
}
|
||||
cmd_to_fail.close()!
|
||||
assert cmd_to_fail.exit_code != 0 // 2 on linux, 1 on macos
|
||||
}
|
||||
Reference in new issue
Block a user