mirror of
https://github.com/MeiK2333/river.git
synced 2025-11-04 14:49:40 +08:00
移除对 macOS 的支持(因为关键的特性做不到)
This commit is contained in:
parent
359a2fe2c3
commit
57e6285013
14
Dockerfile
Normal file
14
Dockerfile
Normal file
@ -0,0 +1,14 @@
|
||||
FROM ubuntu:18.04
|
||||
|
||||
ENV LANG C.UTF-8
|
||||
|
||||
# install python3.6
|
||||
RUN apt update && \
|
||||
apt install -y software-properties-common && \
|
||||
add-apt-repository -y ppa:deadsnakes/ppa && \
|
||||
apt install python3.6
|
||||
|
||||
# install rust
|
||||
RUN apt install -y curl && \
|
||||
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y
|
||||
ENV PATH=/root/.cargo/bin:$PATH
|
||||
@ -25,8 +25,8 @@ message JudgeRequest {
|
||||
}
|
||||
JudgeType judge_type = 3;
|
||||
|
||||
string in_data = 4;
|
||||
string out_data = 5;
|
||||
bytes in_data = 4;
|
||||
bytes out_data = 5;
|
||||
|
||||
int32 time_limit = 6;
|
||||
int32 memory_limit = 7;
|
||||
|
||||
@ -78,7 +78,7 @@ pub async fn compile(request: &JudgeRequest, path: &Path) -> Result<JudgeRespons
|
||||
Some(Language::Go) => "main.go",
|
||||
None => return Err(Error::LanguageNotFound(request.language)),
|
||||
};
|
||||
if let Err(e) = fs::write(path.join(filename), request.code.clone()).await {
|
||||
if let Err(e) = fs::write(path.join(filename), &request.code).await {
|
||||
return Err(Error::FileWriteError(e));
|
||||
};
|
||||
|
||||
|
||||
@ -173,19 +173,6 @@ impl Drop for ExecArgs {
|
||||
}
|
||||
}
|
||||
|
||||
const ITIMER_REAL: libc::c_int = 0;
|
||||
extern "C" {
|
||||
#[cfg_attr(
|
||||
all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "setitimer$UNIX2003"
|
||||
)]
|
||||
fn setitimer(
|
||||
which: libc::c_int,
|
||||
new_value: *const libc::itimerval,
|
||||
old_value: *mut libc::itimerval,
|
||||
) -> libc::c_int;
|
||||
}
|
||||
|
||||
fn run(process: Process) {
|
||||
// 子进程里崩溃也无法返回,崩溃就直接崩溃了
|
||||
let exec_args = ExecArgs::build(&process.cmd).unwrap();
|
||||
@ -225,7 +212,7 @@ fn run(process: Process) {
|
||||
0o644,
|
||||
);
|
||||
// 墙上时钟限制
|
||||
if setitimer(ITIMER_REAL, &rt, ptr::null_mut()) == -1 {
|
||||
if libc::setitimer(libc::ITIMER_REAL, &rt, ptr::null_mut()) == -1 {
|
||||
eprintln!("setitimer failure!");
|
||||
eprintln!("{:?}", io::Error::last_os_error().raw_os_error());
|
||||
panic!("How dare you!");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user