Skip to content

Commit 0b60b6f

Browse files
committed
Add os.EX_* constants
1 parent 8698b00 commit 0b60b6f

3 files changed

Lines changed: 28 additions & 0 deletions

File tree

Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vm/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ flamer = { version = "0.3", optional = true }
7171
[target.'cfg(all(unix, not(any(target_os = "android", target_os = "redox"))))'.dependencies]
7272
pwd = "1"
7373

74+
[target.'cfg(unix)'.dependencies]
75+
exitcode = "1.1.2"
76+
7477
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
7578
crc32fast = "1.2.0"
7679
adler32 = "1.0.3"

vm/src/stdlib/os.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ use std::os::windows::fs::OpenOptionsExt;
1111
use std::time::{Duration, SystemTime};
1212
use std::{env, fs};
1313

14+
#[cfg(unix)]
15+
use exitcode;
1416
#[cfg(unix)]
1517
use nix::errno::Errno;
1618
#[cfg(all(unix, not(target_os = "redox")))]
@@ -1292,6 +1294,22 @@ fn extend_module_platform_specific(vm: &VirtualMachine, module: PyObjectRef) ->
12921294
"SEEK_SET" => ctx.new_int(Whence::SeekSet as i8),
12931295
"SEEK_CUR" => ctx.new_int(Whence::SeekCur as i8),
12941296
"SEEK_END" => ctx.new_int(Whence::SeekEnd as i8),
1297+
"EX_OK" => ctx.new_int(exitcode::OK as i8),
1298+
"EX_USAGE" => ctx.new_int(exitcode::USAGE as i8),
1299+
"EX_DATAERR" => ctx.new_int(exitcode::DATAERR as i8),
1300+
"EX_NOINPUT" => ctx.new_int(exitcode::NOINPUT as i8),
1301+
"EX_NOUSER" => ctx.new_int(exitcode::NOUSER as i8),
1302+
"EX_NOHOST" => ctx.new_int(exitcode::NOHOST as i8),
1303+
"EX_UNAVAILABLE" => ctx.new_int(exitcode::UNAVAILABLE as i8),
1304+
"EX_SOFTWARE" => ctx.new_int(exitcode::SOFTWARE as i8),
1305+
"EX_OSERR" => ctx.new_int(exitcode::OSERR as i8),
1306+
"EX_OSFILE" => ctx.new_int(exitcode::OSFILE as i8),
1307+
"EX_CANTCREAT" => ctx.new_int(exitcode::CANTCREAT as i8),
1308+
"EX_IOERR" => ctx.new_int(exitcode::IOERR as i8),
1309+
"EX_TEMPFAIL" => ctx.new_int(exitcode::TEMPFAIL as i8),
1310+
"EX_PROTOCOL" => ctx.new_int(exitcode::PROTOCOL as i8),
1311+
"EX_NOPERM" => ctx.new_int(exitcode::NOPERM as i8),
1312+
"EX_CONFIG" => ctx.new_int(exitcode::CONFIG as i8),
12951313
});
12961314

12971315
#[cfg(not(target_os = "redox"))]

0 commit comments

Comments
 (0)