Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
P
pager-rs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
6
Issues
6
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Cyril Plisko
pager-rs
Commits
add9c4b2
Commit
add9c4b2
authored
Nov 03, 2016
by
Cyril Plisko
🤔
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add errno
parent
bcfc0fd5
Pipeline
#4860065
failed with stage
in 3 minutes
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
1 deletion
+12
-1
Cargo.toml
Cargo.toml
+1
-0
src/lib.rs
src/lib.rs
+1
-0
src/utils.rs
src/utils.rs
+10
-1
No files found.
Cargo.toml
View file @
add9c4b2
...
...
@@ -11,4 +11,5 @@ repository = "https://gitlab.com/imp/pager-rs.git"
version
=
"0.9.3"
[dependencies]
errno
=
"0.1.8"
libc
=
"0.2"
src/lib.rs
View file @
add9c4b2
...
...
@@ -38,6 +38,7 @@
//! will skip initialization. The host application will continue as normal. `Pager::ok()` will
//! reflect the fact that no Pager is active.
extern
crate
errno
;
extern
crate
libc
;
mod
utils
;
...
...
src/utils.rs
View file @
add9c4b2
...
...
@@ -3,6 +3,7 @@ use std::ffi::{CString, OsString};
use
std
::
os
::
unix
::
ffi
::
OsStringExt
;
use
std
::
ptr
;
use
errno
;
use
libc
;
fn
osstring2cstring
(
s
:
&
OsString
)
->
CString
{
...
...
@@ -22,12 +23,20 @@ pub fn fork() -> libc::pid_t {
}
pub
fn
execvp
(
cmd
:
&
OsString
)
{
// println!("cmd {:?}", cmd);
let
mut
args
=
Vec
::
with_capacity
(
2
);
for
arg
in
split_string
(
cmd
)
{
// println!("arg {:?}", arg);
args
.push
(
osstring2cstring
(
&
arg
)
.as_ptr
())
}
args
.push
(
ptr
::
null
());
assert
!
(
unsafe
{
libc
::
execvp
(
args
[
0
],
args
.as_ptr
())
}
>
-
1
);
// println!("args {:?}", args);
errno
::
set_errno
(
errno
::
Errno
(
0
));
// println!("errno pre {}", errno::errno());
// println!("Going to run execvp({:?}, {:?})", args[0], args.as_ptr());
unsafe
{
libc
::
execvp
(
args
[
0
],
args
.as_ptr
())
};
// println!("errno post {}", errno::errno());
assert
!
(
false
);
}
pub
fn
dup2
(
fd1
:
i32
,
fd2
:
i32
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment