Rewrite edit_in_tmpfile() for new Runtime::editor() signature
This commit is contained in:
parent
ea38f2ffbf
commit
7429754665
1 changed files with 13 additions and 12 deletions
|
@ -72,18 +72,19 @@ impl EditHeader for Entry {
|
||||||
pub fn edit_in_tmpfile(rt: &Runtime, s: &mut String) -> Result<()> {
|
pub fn edit_in_tmpfile(rt: &Runtime, s: &mut String) -> Result<()> {
|
||||||
use libimagutil::edit::edit_in_tmpfile_with_command;
|
use libimagutil::edit::edit_in_tmpfile_with_command;
|
||||||
|
|
||||||
rt.editor()
|
let editor = rt
|
||||||
.ok_or(EE::from_kind(EditErrorKind::NoEditor))
|
.editor()
|
||||||
.and_then(|editor| {
|
.chain_err(|| EditErrorKind::NoEditor)?
|
||||||
edit_in_tmpfile_with_command(editor, s)
|
.ok_or_else(|| EE::from_kind(EditErrorKind::NoEditor))?;
|
||||||
.chain_err(|| EditErrorKind::IOError)
|
|
||||||
.and_then(|worked| {
|
edit_in_tmpfile_with_command(editor, s)
|
||||||
if !worked {
|
.chain_err(|| EditErrorKind::IOError)
|
||||||
Err(EditErrorKind::ProcessExitFailure.into())
|
.and_then(|worked| {
|
||||||
} else {
|
if !worked {
|
||||||
Ok(())
|
Err(EditErrorKind::ProcessExitFailure.into())
|
||||||
}
|
} else {
|
||||||
})
|
Ok(())
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue